Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chemzqm/editable
component for simple inline editing
https://github.com/chemzqm/editable
Last synced: about 1 month ago
JSON representation
component for simple inline editing
- Host: GitHub
- URL: https://github.com/chemzqm/editable
- Owner: chemzqm
- Created: 2013-08-09T18:53:36.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-09-22T14:14:38.000Z (over 11 years ago)
- Last Synced: 2024-10-29T10:44:33.674Z (about 2 months ago)
- Language: JavaScript
- Size: 723 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# editable
Simple and tiny Edit in place for component
With key bindings, `esc` for cancel `enter` for confirm
[demo](http://chemzqm.github.io/editable/)
## Installation
Install with [component(1)](http://component.io):
$ component install chemzqm/editable
## Usage
``` js
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