Skip to content

Commit

Permalink
fix: emits event arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
luthfimasruri committed Mar 18, 2021
1 parent 18266b0 commit 03b4faf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/QuillEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ export default defineComponent({
// Create new instance
quill = new Quill(editor.value, options);
// Set editor content
if (typeof props.content === "string")
if (typeof props.content === "string") {
quill.setText(props.content);
else
ctx.emit("update:content", quill.getContents());
} else {
quill.setContents(props.content as Delta);
}
// Set event handlers
quill.on("text-change", handleTextChange);
quill.on("selection-change", handleSelectionChange);
Expand Down Expand Up @@ -156,8 +158,8 @@ export default defineComponent({
else ctx.emit("blur", editor);
})

const handleEditorChange: EditorChangeHandler = (name: String, ...args) => {
ctx.emit("editorChange", { name, ...args });
const handleEditorChange: EditorChangeHandler = (...args) => {
ctx.emit("editorChange", { ...args });
};

const getQuill = (): Quill => {
Expand All @@ -167,7 +169,7 @@ export default defineComponent({
or use v-on:ready="onReady(quill)" event instead.`
}

const getHTML = (): String => {
const getHTML = (): string => {
return quill?.root.innerHTML ?? ""
}

Expand Down

0 comments on commit 03b4faf

Please sign in to comment.