Listen to and manipulate the text caret.
Install with component(1):
$ component install lepture/caret
All methods are refered to the instance of Caret
:
var caret = new Caret(element)
Get the selection object.
Get the range object.
The parent node of caret.
var node = caret.parent()
Block level parent node of caret.
var node = caret.blockParent()
Save caret position.
Restore caret position.
Bind delegate event handler.
Unbind delegate event handler.
Events that caret emits.
When it has selected text.
When caret moved.
MIT