From 8bb9550f9075d8321679b11ba8f266f1689062d5 Mon Sep 17 00:00:00 2001 From: weiwenda <994184916@qq.com> Date: Mon, 19 Aug 2024 19:00:05 +0800 Subject: [PATCH] =?UTF-8?q?markdown=E4=B8=8B=E8=BD=BD=E5=A4=96=E9=93=BE?= =?UTF-8?q?=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/prod.js | 4 ++-- src/components/layout/index.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main/prod.js b/main/prod.js index c73369fe..18fd77da 100644 --- a/main/prod.js +++ b/main/prod.js @@ -79,9 +79,9 @@ async function startExpress(args) { const filename = picUrl.split('/').pop().replace(/[^\w]/g, '') const distinctFileName = genRandomFileName(filename) downloadImage(picUrl, path.join(gitHome, IMAGES_FOLDER, distinctFileName)).then(() => { - res.send({data: {originalURL: picUrl, url: `http://localhost:${port}/api/${IMAGES_FOLDER}/${distinctFileName}`}}) + res.send({msg: '', code: 0, data: {originalURL: picUrl, url: `http://localhost:${port}/api/${IMAGES_FOLDER}/${distinctFileName}`}}) }).catch(() => { - res.send({data: {originalURL: picUrl, url: picUrl}}) + res.send({msg: '', code: 0, data: {originalURL: picUrl, url: picUrl}}) }) }) // app.post('/api/ocr_image', multer().single('file'), async function(req, res) { diff --git a/src/components/layout/index.tsx b/src/components/layout/index.tsx index 121d6bd9..4147c4b7 100644 --- a/src/components/layout/index.tsx +++ b/src/components/layout/index.tsx @@ -133,8 +133,8 @@ function LayoutComponent(props: {session: Session, config: Config, pluginManager if (modalName === 'md') { setTimeout(() => { const vditor = new Vditor('vditor', { - mode: 'sv', upload: { + linkToImgUrl: API_BASE_URL + '/download_image', handler: (files: File[]) => new Promise(resolve => { uploadImage(files[0], props.session.clientStore.getClientSetting('curDocId'), @@ -156,7 +156,7 @@ function LayoutComponent(props: {session: Session, config: Config, pluginManager height: window.innerHeight - 360, toolbar: ['quote', '|', 'headings', 'bold', 'italic', 'strike', 'inline-code', '|', 'list', 'ordered-list', 'check' , '|', 'link', 'upload', 'table', 'code', '|', - 'insert-before', 'insert-after', 'undo', 'redo'], + 'insert-before', 'insert-after', 'undo', 'redo', '|', 'edit-mode'], after: () => { vditor.setValue(data.md || ''); setVd(vditor);