2
我试图找到一种方法来使用document.execCommand进行自定义命令。 基本上,我需要有类似的东西自定义execCommand命令
document.execCommand('customCommand');
customCommand在这种情况下会选择包的内容与特定的标记。我能够通过使用range.surroundContents来实现这一目标,但是,我还需要的是能够在任何给定时间撤销操作。因此,例如,当您执行execCommand('bold')两次,在第一次运行后,它使文本变粗体,第二次运行变粗体。
有没有像range.unsurroundContents?