简体   繁体   English

替代“ document.execCommand”的技术

[英]Substitute techniques for “document.execCommand”

I am currently working on a WYSIWYG web editor using only Jquery and CSS. 我目前仅使用Jquery和CSS在所见即所得的Web编辑器上工作。

I was sort of annoyed by the inconsistencies of execCommand across all browsers. 跨所有浏览器的execCommand的不一致让我有些恼火。

Is there another technique you can achieve something similar to execCommand does. 还有另一种技术可以实现类似于execCommand的功能。 Such a detecting highlighted text and change its CSS settings? 如此检测突出显示的文本并更改其CSS设置?

If someone could inspire me with the right direction I really appreciate 如果有人能以正确的方向激励我,我真的很感激

For applying a CSS class to a range or selection, you can use my Rangy library and its CSS class applier module ( demo ). 要将CSS类应用于范围或选择,可以使用我的Rangy库及其CSS类应用程序模块demo )。 I'm also working on a replacement for document.execCommand() built on Rangy but that's in the fairly early stages at the moment ( bold demo ). 我还在研究替代基于Rangy构建的document.execCommand() ,但是目前还处于初期阶段( 粗体演示 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM