Skip to content

lepture/caret

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caret

Listen to and manipulate the text caret.

Installation

Install with component(1):

$ component install lepture/caret

API

All methods are refered to the instance of Caret:

var caret = new Caret(element)

.selection()

Get the selection object.

.range()

Get the range object.

.parent()

The parent node of caret.

var node = caret.parent()

.blockParent()

Block level parent node of caret.

var node = caret.blockParent()

.save(range)

Save caret position.

.restore(range)

Restore caret position.

.on(event, fn)

Bind delegate event handler.

.off(event, fn)

Unbind delegate event handler.

Events

Events that caret emits.

select(event, selection)

When it has selected text.

change

When caret moved.

License

MIT

About

Manipulate caret, selection and range.

Resources

Stars

Watchers

Forks

Packages

No packages published