Monday, May 20, 2024
87
rated 0 times [  89] [ 2]  / answers: 1 / hits: 19985  / 15 Years ago, fri, march 5, 2010, 12:00:00

I have made a plugin for CKEditor, but it relies on the currently selected text.



In FF and Chrome I can use:



var selectedText = editor.getSelection().getNative();  


but this doesn't work in IE and I only get [object Object]



Any suggestions?


More From » internet-explorer

 Answers
49

This is what I use:



var mySelection = editor.getSelection();

if (CKEDITOR.env.ie) {
mySelection.unlock(true);
selectedText = mySelection.getNative().createRange().text;
} else {
selectedText = mySelection.getNative();
}

[#97419] Tuesday, March 2, 2010, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nikokorbinm

Total Points: 744
Total Questions: 126
Total Answers: 104

Location: Jersey
Member since Fri, Oct 1, 2021
3 Years ago
;