Hi, this lib looks great! Sorry for the stupid question, but I'm a newbie in JS world. I was trying to programmatically set the selection in the editor so that I can apply some formatting to specific words, but I cannot manage to do it. Here is my sample code, could anyone point me in the right direction?
var selection = editor.composer.selection;
var r = selection.getRange();
r.startOffset = 3;
r.endOffset = 6;
I also tried using rangyinput to do the same; it works in a normal textarea, but not here. Sample:
var ta = editor.textarea.element;
Hi @Myrmex, did you have any success here?
I'm sorry I didn't. I looked for several libraries, but it seems that none allows for programmatic selection.
I'm looking at it.. wysihtml5 uses rangy (http://code.google.com/p/rangy/), and it seems to make it possible.
There is a nice example here:
You can, for example, select a node:
I'm trying to make a selection based on an array-like reference, pointing beginning and end. The range object seems to carry the answer, needs some hacking.
Maybe, this is the path..
Could not implement.
There is a module under development called "rangy-textrange", it adds some extra functions that can help us with this. Will be released at rangy 1.3