balm-ui
Version:
A modular and customizable UI library based on Material Design and Vue 3
25 lines (18 loc) • 499 B
JavaScript
import { useEditor } from '../core/quill';
function useHtml() {
const { Quill } = useEditor();
const Parchment = Quill.import('parchment');
class HtmlBlot extends Parchment.EmbedBlot {
static create(value) {
let node = super.create();
if (typeof value === 'string') {
node.innerHTML = value;
}
return node;
}
}
HtmlBlot.blotName = 'html';
HtmlBlot.tagName = 'DIV';
Quill.register('formats/html', HtmlBlot, true);
}
export default useHtml;