mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-21 09:57:28 +08:00
Fix paste upload handler
This commit is contained in:
@@ -162,9 +162,7 @@ export function createVditor(editorId, options = {}) {
|
|||||||
input,
|
input,
|
||||||
after
|
after
|
||||||
})
|
})
|
||||||
const container = document.getElementById(editorId)
|
const pasteHandler = async (e) => {
|
||||||
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 = []
|
||||||
@@ -182,7 +180,14 @@ 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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user