nhn / tui.editor

šŸžšŸ“ Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
http://ui.toast.com/tui-editor
MIT License
17.18k stars 1.75k forks source link

Issue with Character Data (CDATA XML tag) #1858

Open ghost opened 3 years ago

ghost commented 3 years ago

Describe the bug

Adding a Character Data (CDATA) tag <![CDATA[something]]> in the WYSIWYG or markdown view will break the editor. The HTML generated will be incomplete and a JS error is triggered when going from markdown to WYSIWYG.

Uncaught TypeError: Cannot read properties of null (reading '1')
    at htmlBlock (ccf7da5b-793eb8a61f9f01d3d003.js:2)
    at o (ccf7da5b-793eb8a61f9f01d3d003.js:2)
    at e.convert (ccf7da5b-793eb8a61f9f01d3d003.js:2)
    at e.convertNode (ccf7da5b-793eb8a61f9f01d3d003.js:2)
    at e.toWysiwygModel (ccf7da5b-793eb8a61f9f01d3d003.js:2)
    at t.e.changeMode (ccf7da5b-793eb8a61f9f01d3d003.js:2)
    at ccf7da5b-793eb8a61f9f01d3d003.js:2
    at Array.forEach (<anonymous>)
    at e.emit (ccf7da5b-793eb8a61f9f01d3d003.js:2)
    at HTMLDivElement.<anonymous> (ccf7da5b-793eb8a61f9f01d3d003.js:2)

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://ui.toast.com/tui-editor
  2. In the WYSIWYG or markdown, add some text and in the middle add a <![CDATA[something]]>
  3. The tag will not be displayed in the markdown preview, and you will not be able to go back in WYSIWYG mode
js87zz commented 3 years ago

@infiniweb Sorry for late replying. I checked the issue and It will be fixed.