Skip to content

chemzqm/editable

Repository files navigation

editable

Simple and tiny Edit in place for component

With key bindings, esc for cancel enter for confirm

demo

Installation

Install with component(1):

$ component install chemzqm/editable

Usage

var Editable = require('editable');
var node = document.getElementById('test');
var ed = new Editable(node);
ed.on('change', function(v){
  console.log(v);
})

Events

  • change emit with the changed value.

  • range error emit when the value length is not in limited range.

API

new Editable(node)

Create Editable instance

editable#limit(min, max)

min number, max number of the value length.

editable#value()

Get current node html.

editable#reset()

Reset the value to previous, useful for undo no change event emitted.

editable#remove()

Unregist the events

License

MIT

About

component for simple inline editing

Resources

Stars

Watchers

Forks

Packages

No packages published