From 67be51f9a677f621d85a20b2d26a5d5343267b53 Mon Sep 17 00:00:00 2001 From: Frankie Huang Date: Thu, 10 Apr 2025 02:28:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=20editor.md=20?= =?UTF-8?q?=E7=9A=84=20JS=20=E6=96=87=E4=BB=B6,=E4=BF=AE=E5=A4=8D=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=9C=BA=E6=99=AF=E4=B8=8B=E8=A7=A3=E6=9E=90=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/editor.md/editormd.amd.js | 7 +++++++ public/static/editor.md/editormd.js | 7 +++++++ public/static/editor.md/src/editormd.js | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/public/static/editor.md/editormd.amd.js b/public/static/editor.md/editormd.amd.js index daf4994..2eef2e2 100644 --- a/public/static/editor.md/editormd.amd.js +++ b/public/static/editor.md/editormd.amd.js @@ -3901,6 +3901,13 @@ if (typeof attrs !== "undefined") { + // 将 html 标签的 attr value 中存在的 <> 进行转义 + // 示例 替换为 + html = html.replace(/(\w+)="([^"]*)"/g, (match, key, value) => { + const escapedValue = value.replace(//g, '>'); + return `${key}="${escapedValue}"`; + }); + var htmlTagRegex = /\<(\w+)\s*([^\>]*)\>([^\>]*)\<\/(\w+)\>/ig; if (attrs === "*") diff --git a/public/static/editor.md/editormd.js b/public/static/editor.md/editormd.js index c33c097..953eec8 100644 --- a/public/static/editor.md/editormd.js +++ b/public/static/editor.md/editormd.js @@ -3832,6 +3832,13 @@ if (typeof attrs !== "undefined") { + // 将 html 标签的 attr value 中存在的 <> 进行转义 + // 示例 替换为 + html = html.replace(/(\w+)="([^"]*)"/g, (match, key, value) => { + const escapedValue = value.replace(//g, '>'); + return `${key}="${escapedValue}"`; + }); + var htmlTagRegex = /\<(\w+)\s*([^\>]*)\>([^\>]*)\<\/(\w+)\>/ig; if (attrs === "*") diff --git a/public/static/editor.md/src/editormd.js b/public/static/editor.md/src/editormd.js index bf4f7f1..f669a78 100644 --- a/public/static/editor.md/src/editormd.js +++ b/public/static/editor.md/src/editormd.js @@ -3822,6 +3822,13 @@ if (typeof attrs !== "undefined") { + // 将 html 标签的 attr value 中存在的 <> 进行转义 + // 示例 替换为 + html = html.replace(/(\w+)="([^"]*)"/g, (match, key, value) => { + const escapedValue = value.replace(//g, '>'); + return `${key}="${escapedValue}"`; + }); + var htmlTagRegex = /\<(\w+)\s*([^\>]*)\>([^\>]*)\<\/(\w+)\>/ig; if (attrs === "*")