nega-editable-text
v0.1.1
Published
Inline plain text editing webcomponent
Downloads
4
Readme
nega-editable-text
<nega-editable-text>
Inline plain text editing webcomponent
See: Documentation, Demo.
Usage
Installation
npm install --save nega-editable-text
In an html file
<html>
<head>
<script type="module">
import 'nega-editable-text/nega-editable-text.js';
</script>
</head>
<body>
<nega-editable-text><span>This text can be editable.</span></nega-editable-text>
<button onclick="this.previousElementSibling.edit()">Edit</button>
</body>
</html>
In a Polymer 3 element
import {PolymerElement, html} from '@polymer/polymer';
import 'nega-autocomplete/nega-autocomplete.js';
class SampleElement extends PolymerElement {
static get template() {
return html`
<nega-editable-text id="editalbe"><span id="text">This text can be editable.</span></nega-editable-text>
<button on-click="_handleEdit">Edit</button>
`;
}
_handleEdit(ev) {
this.$.editable.edit()
}
}
customElements.define('sample-element', SampleElement);
Contributing
Feel free to fork and send over PRs. Still a lot of places this can be improved, i.e. styling, more options, or better behaviors.
Installation
git clone https://github.com/kennethklee/nega-editable-text
cd nega-editable-text
npm install
Running locally
$ npm start
Running tests
$ npm test