Reputation: 1083
Can anyone tell me how to expand or enlarge the selection in CKEditor.
I can get the selection using
var EditorInstance = CKEDITOR.instances['Editor'];
var selection = EditorInstance.getSelection();
but what i want is to enlarge that selection with javascript.
For example this is my selection now
then i want to expand or enlarge that selection like this
And this selection may contain tags like bold italic also.. Using javaScript only please help me..
Upvotes: 1
Views: 723
Reputation: 2875
To extend the Selection
you can use the modify()
method as long as you're in a modern web browser. For example, to extend the selection forward by one word, you could do this:
var selection = window.getSelection();
selection.modify("extend", "forward", "word");
You can also specify to extend backward, and you can specify to extend by word, character, line, etc.
Upvotes: 1