ui: fix vditor upload in other pages (#329)

This commit is contained in:
panda authored and GitHub committed 2022-03-27 16:40:58 +08:00
1 parent 76984d985c
commit 628af620bb
1 file changed
+2 -1
@@ -162,6 +162,7 @@ export default class Editor extends DOMAttachedObject {
async initVditor() {
const pagename = document.documentElement.getAttribute('data-page');
const isProblemPage = ['problem_create', 'problem_edit'].includes(pagename);
const isProblemEdit = pagename === 'problem_edit';
const { default: Vditor } = await import('vditor');
const { $dom } = this;
@@ -209,7 +210,7 @@ export default class Editor extends DOMAttachedObject {
},
})
.then(() => {
this.vditor.insertValue(`${wrapper.join(`file://${filename}`)} `);
this.vditor.insertValue(`${wrapper.join(`${isProblemPage ? 'file://' : `/file/${UserContext._id}/`}${filename}`)} `);
this.vditor.vditor.tip.hide();
})
.catch((e: { message: string; }) => {