mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-30 06:27:38 +08:00
fix: enable tips
This commit is contained in:
@@ -81,7 +81,7 @@ export function createVditor(editorId, options = {}) {
|
|||||||
multiple: false,
|
multiple: false,
|
||||||
handler: async (files) => {
|
handler: async (files) => {
|
||||||
const file = files[0]
|
const file = files[0]
|
||||||
vditor.tip.show('图片上传中', 0)
|
vditor.tip('图片上传中', 0)
|
||||||
vditor.disabled()
|
vditor.disabled()
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`${API_BASE_URL}/api/upload/presign?filename=${encodeURIComponent(file.name)}`,
|
`${API_BASE_URL}/api/upload/presign?filename=${encodeURIComponent(file.name)}`,
|
||||||
@@ -89,14 +89,14 @@ export function createVditor(editorId, options = {}) {
|
|||||||
)
|
)
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
vditor.enable()
|
vditor.enable()
|
||||||
vditor.tip.hide()
|
vditor.tip('获取上传地址失败')
|
||||||
return '获取上传地址失败'
|
return '获取上传地址失败'
|
||||||
}
|
}
|
||||||
const info = await res.json()
|
const info = await res.json()
|
||||||
const put = await fetch(info.uploadUrl, { method: 'PUT', body: file })
|
const put = await fetch(info.uploadUrl, { method: 'PUT', body: file })
|
||||||
if (!put.ok) {
|
if (!put.ok) {
|
||||||
vditor.enable()
|
vditor.enable()
|
||||||
vditor.tip.hide()
|
vditor.tip('上传失败')
|
||||||
return '上传失败'
|
return '上传失败'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ export function createVditor(editorId, options = {}) {
|
|||||||
}
|
}
|
||||||
vditor.insertValue(md + '\n')
|
vditor.insertValue(md + '\n')
|
||||||
vditor.enable()
|
vditor.enable()
|
||||||
vditor.tip.hide()
|
vditor.tip('上传成功')
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user