Ami*_*ode 5 wordpress tinymce tinymce-4 tinymce-plugins
为TinyMCE制作一个自定义插件,我想知道如何根据当前光标位置自动选择一个单词,就像在Wordpress"添加链接"插件中一样.
我搜索过Wordpress TinyMCe Wplink代码和TinyMCE文档,但我没有参考....
你可以像下面这样做
if (editor.selection.isCollapsed()) {
var selRng = editor.selection.getRng();
selRng.expand("word"); //expands the DOM range to the current word
editor.selection.setRng(selRng);
}
Run Code Online (Sandbox Code Playgroud)
下面是相同的 JS Fiddle
https://jsfiddle.net/t9qhmguo/

| 归档时间: |
|
| 查看次数: |
176 次 |
| 最近记录: |