nhn / tui.editor

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

Is there any way to exempt the editor's initial state from the undo list? #3195

Open Martin-Alexander opened 8 months ago

Martin-Alexander commented 8 months ago

When the editor is loaded with an initial value (for instance, the demo here https://ui.toast.com/tui-editor) issuing an undo command (e.g., with Cmd+Z on macOS) all the content in the editor is deleted.

Most editors and text inputs don't work this way and users seem to find it confusing (and especially frustrating if they're not familiar with the redo shortcut).

Is there a way of preventing this behaviour? Perhaps by clearing the undo history when the editor loads?

prostoandrei commented 5 months ago

Yes, it's an API design problem. The only way I got around it was to put onKeyDown processing on the wrapper component.