fix: tip tap undo and redo
This commit is contained in:
parent
d8fbfe1697
commit
88e34fb69c
1 changed files with 13 additions and 0 deletions
|
|
@ -48,6 +48,11 @@ export const handleVSCMetaKeyIssues = async (
|
|||
x: () => handleCutOperation(text, editor),
|
||||
c: () => handleCopyOperation(text),
|
||||
v: () => handlePasteOperation(editor),
|
||||
z: () => {
|
||||
return e.shiftKey
|
||||
? handleRedoOperation(editor)
|
||||
: handleUndoOperation(editor);
|
||||
},
|
||||
};
|
||||
|
||||
if (e.key in handlers) {
|
||||
|
|
@ -130,3 +135,11 @@ export const handlePasteOperation = async (editor: Editor) => {
|
|||
document.execCommand("paste");
|
||||
}
|
||||
};
|
||||
|
||||
export const handleUndoOperation = async (editor: Editor) => {
|
||||
editor.commands.undo();
|
||||
};
|
||||
|
||||
export const handleRedoOperation = async (editor: Editor) => {
|
||||
editor.commands.redo();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue