Skip to content

Commit 82372a8

Browse files
committed
fix: fix html to escape issue. (#494)
#406 #228 #357
1 parent 40097f0 commit 82372a8

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

core/src/components/TextArea/Markdown.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ import { IProps } from '../../Editor';
55
import { EditorContext } from '../../Context';
66

77
function html2Escape(sHtml: string) {
8-
return sHtml
9-
.replace(/```(\w+)?([\s\S]*?)(\s.+)?```/g, (str: string) => {
10-
return str.replace(
8+
return (
9+
sHtml
10+
// .replace(/```(\w+)?([\s\S]*?)(\s.+)?```/g, (str: string) => {
11+
// return str.replace(
12+
// /[<&"]/g,
13+
// (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' } as Record<string, string>)[c]),
14+
// );
15+
// })
16+
.replace(
1117
/[<&"]/g,
1218
(c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' } as Record<string, string>)[c]),
13-
);
14-
})
15-
.replace(
16-
/[<&"]/g,
17-
(c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;' } as Record<string, string>)[c]),
18-
);
19+
)
20+
);
1921
}
2022

2123
export interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {}

0 commit comments

Comments
 (0)