mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-07-20 11:36:07 +00:00
feat: vditor 修改
This commit is contained in:
@@ -162,27 +162,6 @@ export function createVditor(editorId, options = {}) {
|
|||||||
input,
|
input,
|
||||||
after
|
after
|
||||||
})
|
})
|
||||||
const container = document.getElementById(editorId)
|
|
||||||
if (container) {
|
|
||||||
container.addEventListener('paste', async (e) => {
|
|
||||||
const items = e.clipboardData && e.clipboardData.items
|
|
||||||
if (!items) return
|
|
||||||
const files = []
|
|
||||||
for (let i = 0; i < items.length; i++) {
|
|
||||||
const item = items[i]
|
|
||||||
if (item.kind === 'file') {
|
|
||||||
const file = item.getAsFile()
|
|
||||||
if (file) files.push(file)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (files.length > 0) {
|
|
||||||
e.preventDefault()
|
|
||||||
const err = await vditor.options.upload.handler(files)
|
|
||||||
if (typeof err === 'string') {
|
|
||||||
vditor.tip(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return vditor
|
return vditor
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user