From c1d71a136acafc9e131715aaed920324649385bf Mon Sep 17 00:00:00 2001 From: yangjian Date: Fri, 18 Dec 2020 20:13:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0EditorMD=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E7=9A=84base=E5=8D=95=E9=97=AD=E5=90=88?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/editor.md/editormd.js | 1 + template/app_doc/docs_base.html | 1 + template/app_doc/editor/tpl_editor_editormd.html | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/static/editor.md/editormd.js b/static/editor.md/editormd.js index 2a25e2b..012113a 100644 --- a/static/editor.md/editormd.js +++ b/static/editor.md/editormd.js @@ -4167,6 +4167,7 @@ var tag = filterTags[i]; html = html.replace(new RegExp("\<\s*" + tag + "\s*([^\>]*)\>([^\>]*)\<\s*\/" + tag + "\s*\>", "igm"), ""); + html = html.replace(new RegExp("\<\s*" + tag + ".*?/?>", "igm"), "") // 过滤单闭合标签 } //return html; diff --git a/template/app_doc/docs_base.html b/template/app_doc/docs_base.html index b66ba09..5fa3762 100644 --- a/template/app_doc/docs_base.html +++ b/template/app_doc/docs_base.html @@ -332,6 +332,7 @@ tocContainer : "#toc-container", tocDropdown : false, atLink : false,//禁用@链接 + htmlDecode : "link,style,base,script,iframe", //过滤部分HTML标签 }); {% elif doc.editor_mode == 2 %} diff --git a/template/app_doc/editor/tpl_editor_editormd.html b/template/app_doc/editor/tpl_editor_editormd.html index a5e76e2..9bdd7dd 100644 --- a/template/app_doc/editor/tpl_editor_editormd.html +++ b/template/app_doc/editor/tpl_editor_editormd.html @@ -203,7 +203,7 @@ sequenceDiagram : true, //开启序列图 imageUpload : true, //开启图片上传 codeFold :true, //代码折叠 - htmlDecode : "link,style,script,iframe|on*", //解析部分HTML标签 + htmlDecode : "link,style,base,script,iframe", //过滤部分HTML标签 imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"], imageUploadURL : "{% url 'upload_doc_img' %}", onchange:function(){