fix: 更新 editor.md 的 JS 文件,修复部分场景下解析失败的情况

This commit is contained in:
Frankie Huang 2025-04-10 02:28:11 +08:00
parent 33e1a79ad2
commit 67be51f9a6
3 changed files with 21 additions and 0 deletions

View File

@ -3901,6 +3901,13 @@
if (typeof attrs !== "undefined")
{
// 将 html 标签的 attr value 中存在的 <> 进行转义
// 示例 <a name="<p>code</p>"></a> 替换为 <a name="&lt;p&gt;code&lt;/p&gt;"></a>
html = html.replace(/(\w+)="([^"]*)"/g, (match, key, value) => {
const escapedValue = value.replace(/</g, '&lt;').replace(/>/g, '&gt;');
return `${key}="${escapedValue}"`;
});
var htmlTagRegex = /\<(\w+)\s*([^\>]*)\>([^\>]*)\<\/(\w+)\>/ig;
if (attrs === "*")

View File

@ -3832,6 +3832,13 @@
if (typeof attrs !== "undefined")
{
// 将 html 标签的 attr value 中存在的 <> 进行转义
// 示例 <a name="<p>code</p>"></a> 替换为 <a name="&lt;p&gt;code&lt;/p&gt;"></a>
html = html.replace(/(\w+)="([^"]*)"/g, (match, key, value) => {
const escapedValue = value.replace(/</g, '&lt;').replace(/>/g, '&gt;');
return `${key}="${escapedValue}"`;
});
var htmlTagRegex = /\<(\w+)\s*([^\>]*)\>([^\>]*)\<\/(\w+)\>/ig;
if (attrs === "*")

View File

@ -3822,6 +3822,13 @@
if (typeof attrs !== "undefined")
{
// 将 html 标签的 attr value 中存在的 <> 进行转义
// 示例 <a name="<p>code</p>"></a> 替换为 <a name="&lt;p&gt;code&lt;/p&gt;"></a>
html = html.replace(/(\w+)="([^"]*)"/g, (match, key, value) => {
const escapedValue = value.replace(/</g, '&lt;').replace(/>/g, '&gt;');
return `${key}="${escapedValue}"`;
});
var htmlTagRegex = /\<(\w+)\s*([^\>]*)\>([^\>]*)\<\/(\w+)\>/ig;
if (attrs === "*")