fix: tip tap undo and redo

This commit is contained in:
tomasz-io 2024-12-24 08:36:46 -08:00
parent d8fbfe1697
commit 88e34fb69c

View file

@ -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();
};