获取选定的文本赢得CKEditor插件 [英] Getting selected text win CKEditor Plugin
本文介绍了获取选定的文本赢得CKEditor插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我为CKEditor制作了一个插件,但它依赖于当前选择的文本。
I have made a plugin for CKEditor, but it relies on the currently selected text.
在FF和Chrome中,我可以使用:
In FF and Chrome I can use:
var selectedText = editor.getSelection().getNative();
但这在IE中不起作用,我只得到[object Object]
but this doesnt work in IE and I only get [object Object]
任何建议?
推荐答案
这是我使用的:
var mySelection = editor.getSelection();
if (CKEDITOR.env.ie) {
mySelection.unlock(true);
selectedText = mySelection.getNative().createRange().text;
} else {
selectedText = mySelection.getNative();
}
这篇关于获取选定的文本赢得CKEditor插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文