From 88e34fb69caae3750621f9f93253a7425535928f Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Tue, 24 Dec 2024 08:36:46 -0800 Subject: [PATCH] fix: tip tap undo and redo --- gui/src/components/mainInput/handleMetaKeyIssues.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gui/src/components/mainInput/handleMetaKeyIssues.ts b/gui/src/components/mainInput/handleMetaKeyIssues.ts index 867203a14..baf824bd6 100644 --- a/gui/src/components/mainInput/handleMetaKeyIssues.ts +++ b/gui/src/components/mainInput/handleMetaKeyIssues.ts @@ -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(); +};