From 46cd063e71c7dbff8e4d028c4ae5fe2c993962c7 Mon Sep 17 00:00:00 2001 From: zhanzhenping <128675240+Zzhenping@users.noreply.github.com> Date: Wed, 10 Jul 2024 17:52:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20cherry-markdown=20=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E5=92=8C=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/cherry/cherry-markdown.css | 3 ++- static/js/cherry_markdown.js | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/static/cherry/cherry-markdown.css b/static/cherry/cherry-markdown.css index 060b0019..01db3f42 100644 --- a/static/cherry/cherry-markdown.css +++ b/static/cherry/cherry-markdown.css @@ -3203,7 +3203,8 @@ div[data-type=codeBlock] .token.inserted { } .cherry-editor .cm-s-default .cm-url { - background: #4b4b4b; + background: #f8fafb; + color: #3582fb; font-family: "Menlo", "Liberation Mono", "Consolas", "DejaVu Sans Mono", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-size: 0.9em; } diff --git a/static/js/cherry_markdown.js b/static/js/cherry_markdown.js index b8fc9602..ce20da0f 100644 --- a/static/js/cherry_markdown.js +++ b/static/js/cherry_markdown.js @@ -630,10 +630,11 @@ function myFileUpload(file, callback) { }, success: function (data) { layer.close(layerIndex); - if (data[0].errcode !== 0) { - layer.msg(data[0].message); + // 验证data是否为数组 + if (data.errcode !== 0) { + layer.msg(data.message); } else { - callback(data[0].url); // 假设返回的 JSON 中包含上传文件的 URL,调用回调函数并传入 URL + callback(data.url); // 假设返回的 JSON 中包含上传文件的 URL,调用回调函数并传入 URL } } });