From 5bac21f54548501771405b08263bd0577b9e8676 Mon Sep 17 00:00:00 2001 From: yangjian Date: Mon, 21 Dec 2020 20:14:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96editormd=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E7=B2=98=E8=B4=B4=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app_doc/editor/tpl_editor_editormd.html | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/template/app_doc/editor/tpl_editor_editormd.html b/template/app_doc/editor/tpl_editor_editormd.html index 9bdd7dd..344ae0d 100644 --- a/template/app_doc/editor/tpl_editor_editormd.html +++ b/template/app_doc/editor/tpl_editor_editormd.html @@ -234,19 +234,25 @@ var base64 = event.target.result; //ajax上传图片 layer.load(1); - $.post("{% url 'upload_doc_img' %}",{base:base64}, function (ret) { - layer.msg(ret.message); - if (ret.success === 1) { - //新一行的图片显示 - layer.closeAll("loading"); - editor.insertValue("\n![](" + ret.url + ")"); - editor.focus() - }else{ - layer.closeAll("loading"); - layer.msg("粘贴图片失败!") + $.ajax({ + url:"{% url 'upload_doc_img' %}", + type:"post", + data:{base:base64}, + success:function(ret){ + if (ret.success === 1) { + //新一行的图片显示 + layer.closeAll("loading"); + editor.insertValue("\n![](" + ret.url + ")"); + editor.focus() + }else{ + layer.closeAll("loading"); + layer.msg("粘贴图片失败!") + } + }, + error:function(){ + layer.closeAll('loading'); } - }); - layer.closeAll("loading"); + }) }; // data url! var url = reader.readAsDataURL(blob); }