Revert "Fix paste upload handler"

This reverts commit 97118e7bc8.
This commit is contained in:
tim
2025-08-01 02:12:22 +08:00
parent a97ca0cec9
commit ebc39a6388
+4 -9
View File
@@ -162,7 +162,9 @@ export function createVditor(editorId, options = {}) {
input, input,
after after
}) })
const pasteHandler = async (e) => { const container = document.getElementById(editorId)
if (container) {
container.addEventListener('paste', async (e) => {
const items = e.clipboardData && e.clipboardData.items const items = e.clipboardData && e.clipboardData.items
if (!items) return if (!items) return
const files = [] const files = []
@@ -180,14 +182,7 @@ export function createVditor(editorId, options = {}) {
vditor.tip(err) vditor.tip(err)
} }
} }
}
const elements = []
if (vditor.wysiwyg) elements.push(vditor.wysiwyg.element)
if (vditor.ir) elements.push(vditor.ir.element)
if (vditor.sv) elements.push(vditor.sv.element)
elements.forEach(el => {
el.addEventListener('paste', pasteHandler)
}) })
}
return vditor return vditor
} }