Skip to content

Commit 63f0b3f

Browse files
committed
feat: ✨ add pasteHTML method
1 parent c82bb48 commit 63f0b3f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/vue-quill/src/components/QuillEditor.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ export const QuillEditor = defineComponent({
265265

266266
const setContents = (content: string | Delta, source: Sources = 'api') => {
267267
if (props.contentType === 'html') {
268-
setHTML(content as string, source)
268+
setHTML(content as string)
269269
} else if (props.contentType === 'text') {
270270
setText(content as string, source)
271271
} else {
@@ -285,7 +285,11 @@ export const QuillEditor = defineComponent({
285285
return quill?.root.innerHTML ?? ''
286286
}
287287

288-
const setHTML = (html: string, source: Sources = 'api') => {
288+
const setHTML = (html: string) => {
289+
if (quill) quill.root.innerHTML = html
290+
}
291+
292+
const pasteHTML = (html: string, source: Sources = 'api') => {
289293
const delta = quill?.clipboard.convert(html as {})
290294
if (delta) quill?.setContents(delta, source)
291295
}
@@ -322,6 +326,7 @@ export const QuillEditor = defineComponent({
322326
setContents,
323327
getHTML,
324328
setHTML,
329+
pasteHTML,
325330
getText,
326331
setText,
327332
reinit,

0 commit comments

Comments
 (0)