an event emitter for when the cursor position changes inside of a contenteditable element
JavaScript
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
History.md
Readme.md
component.json
example.html
index.js
package.json

Readme.md

cursor-change

an event emitter for when the cursor position changes in a contenteditable document

Installation

Install with component(1) or duo or NPM.

$npm install cursor-change

Usage

var el = document.getElementsByTagName('div')[0];
var cursor = require('bmcmahen/cursor-change@1.0.0')(el);
cursor.on('change', function(pos){
  console.log('changed to', pos);
});

setTimeout(function(){
  cursor.unbind();
}, 10000);

Note

This specifically does not emit an event for selections. For that, use bmcmahen/monitor-text-selection.

License

MIT