Forked from fxmontigny/get-set-html-quilljs-editor.js
Created
February 11, 2020 01:35
-
-
Save kconde2/9bff57fc74f52276731044417da82cee to your computer and use it in GitHub Desktop.
Insert and get html content with quilljs editor
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
const editor = $('.editor'); | |
const quill = new Quill(editor); | |
// set html content | |
quill.setHTML = (html) => { | |
editor.root.innerHTML = html; | |
}; | |
// get html content | |
quill.getHTML = () => { | |
return editor.root.innerHTML; | |
}; | |
// usages | |
quill.setHTML('<b>Hello my friend</b>'); | |
quill.on('text-change', () => { | |
console.log('get html', quill.getHTML()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment