Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kconde2/9bff57fc74f52276731044417da82cee to your computer and use it in GitHub Desktop.
Save kconde2/9bff57fc74f52276731044417da82cee to your computer and use it in GitHub Desktop.
Insert and get html content with quilljs editor
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