nhn / tui.editor

🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
http://ui.toast.com/tui-editor
MIT License
17.09k stars 1.74k forks source link

Render empty table will crash the WW editor #2744

Open gitpaladin opened 1 year ago

gitpaladin commented 1 year ago

Describe the bug

The return rows may be an empty array in https://github.com/nhn/tui.editor/blob/65c4983a2721729d36e1986d05b17ad30ab87e7c/apps/editor/src/wysiwyg/nodes/tableBody.ts#L23 So if you input <table></table> (which is a valid embedded HTML markdown) will cause Cannot read properties of undefined exception.

To Reproduce

see this sample https://codesandbox.io/s/toast-ui-editor-empty-table-bug-z0hxjk

Expected behavior

Render empty table or keep empty line.

Screenshots

image

Desktop (please complete the following information):

jwlee1108 commented 1 year ago

@gitpaladin Thank you for the issue and your contribution. I'll check it soon.