memos
memos copied to clipboard
redo/undo
Is your feature request related to a problem?
no
Describe the solution you'd like
The editor currently uses the browser textarea comes with redo/undo, but in the call insertText can not generate the browser default undoStack, to solve this problem there are several options.
-
use document.execCommand to replace the current editorRef.current.value assignment, but this api is no longer recommended.
-
generate a snapshot of editorRef.current.value and use the snapshot stack to replace the current value when redo/undo. 3.
-
abstract command and transaction, when modifying content to generate a transaction, including content changes and cursor changes, which is the design of modern rich text editors.
If no one has implemented it I can pr a draft
Additional context
No response
@ChasLui The option2 LGTM. Please have a try.