Created
December 10, 2018 05:36
-
-
Save bhargavkonkathi/e393e79b43c09bc69c198cb01279d95a to your computer and use it in GitHub Desktop.
Quill editor integration with lit-element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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