File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 77import { WidgetType , Decoration , ViewPlugin } from "@codemirror/view" ;
88import { escapeControlChars } from "./editorUtils.mjs" ;
99import { htmlCopyOverride } from "./copyOverride.mjs" ;
10+ import Utils from "../../core/Utils.mjs" ;
1011
1112
1213/**
@@ -64,7 +65,11 @@ class HTMLWidget extends WidgetType {
6465 * @param {DOMNode } textNode
6566 */
6667 replaceControlChars ( textNode ) {
67- const val = escapeControlChars ( textNode . nodeValue , true , this . view . state . lineBreak ) ;
68+ // .nodeValue unencodes HTML encoding such as < to "<"
69+ // We must remember to escape any potential HTML in TextNodes as we do not
70+ // want to render it.
71+ const textValue = Utils . escapeHtml ( textNode . nodeValue ) ;
72+ const val = escapeControlChars ( textValue , true , this . view . state . lineBreak ) ;
6873 if ( val . length !== textNode . nodeValue . length ) {
6974 const node = document . createElement ( "span" ) ;
7075 node . innerHTML = val ;
You can’t perform that action at this time.
0 commit comments