Skip to content

Instantly share code, notes, and snippets.

@bhargavkonkathi
Created December 10, 2018 05:36
Show Gist options
  • Save bhargavkonkathi/e393e79b43c09bc69c198cb01279d95a to your computer and use it in GitHub Desktop.
Save bhargavkonkathi/e393e79b43c09bc69c198cb01279d95a to your computer and use it in GitHub Desktop.
Quill editor integration with lit-element
import { LitElement, html } from "@polymer/lit-element";
import 'quill/';
class QuillEditor extends LitElement {
render(){
return html`
<link rel='stylesheet' href='http://cdn.quilljs.com/1.3.6/quill.snow.css'>
<style>
#editor-container {
height: 375px;
}
</style>
<div id="editor-container"></div>
`
}
constructor(){
super();
}
firstUpdated(){
this.init();
}
init(){
let selector = this.shadowRoot.querySelector('#editor-container');
var quill = new Quill(selector, {
modules: {
toolbar: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline'],
['image', 'code-block','video']
]
},
placeholder: 'Compose an epic...',
theme: 'snow' // or 'bubble'
});
}
}
window.customElements.define('quill-editor',QuillEditor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment