knockout-contenteditable
v0.0.2
Published
Knockout contenteditable binding
Downloads
8
Readme
knockout-contenteditable
Installation
npm install --save-dev knockout-contenteditable
Usage
<div data-bind="contenteditable: editable" contenteditable="true"></div>
ko.applyBindings({
editable: {
value: ko.observable(),
// @param {String} elementValue
// @param {String} eventType trigger event type
encode(elementValue, eventType) {
return elementValue.replace('<br>', '<br>');
},
// @param {String} modelValue
decode(modelValue) {
return elementValue.replace('<br>', '<br>');
}
}
});
License
MIT © BinRui.Guan