You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The root cause is in the @editorjs/code tool's handleHTMLPaste method. When pasting a <pre> element containing <code> child tags, element.innerHTML returns HTML including the <code> tag, which can leak into the code field.
Submitted a fix: editor-js/code#80 — uses element.textContent instead of element.innerHTML to extract plain text only.
The fix for this issue has been submitted in PR #80 to the @editorjs/code repository (editor-js/code#80).
Root cause: handleHTMLPaste in the Code tool uses element.innerHTML instead of element.textContent. When pasting a <pre> element that contains <code> child tags (common from code editors), innerHTML returns the HTML including the <code> tag, which leaks into the code field. Using textContent ensures only plain text is extracted.
Fix: element.innerHTML → element.textContent in src/index.ts.
Activity
fix(paste): use textContent instead of innerHTML to avoid HTML tags i…
waterWang commentedon Aug 11, 2026
The root cause is in the
@editorjs/codetool'shandleHTMLPastemethod. When pasting a<pre>element containing<code>child tags,element.innerHTMLreturns HTML including the<code>tag, which can leak into the code field.Submitted a fix: editor-js/code#80 — uses
element.textContentinstead ofelement.innerHTMLto extract plain text only.waterWang commentedon Aug 11, 2026
The fix for this issue has been submitted in PR #80 to the
@editorjs/coderepository (editor-js/code#80).Root cause:
handleHTMLPastein the Code tool useselement.innerHTMLinstead ofelement.textContent. When pasting a<pre>element that contains<code>child tags (common from code editors),innerHTMLreturns the HTML including the<code>tag, which leaks into the code field. UsingtextContentensures only plain text is extracted.Fix:
element.innerHTML→element.textContentinsrc/index.ts.