Skip to content

Commit

Permalink
fix: prevent default undo (#7946)
Browse files Browse the repository at this point in the history
* fix: prevent default undo

* chore: fix format
  • Loading branch information
BeksOmega authored Apr 2, 2024
1 parent b7cdeff commit b13f8f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/shortcut_items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,11 @@ export function registerUndo() {
preconditionFn(workspace) {
return !workspace.options.readOnly && !Gesture.inProgress();
},
callback(workspace) {
callback(workspace, e) {
// 'z' for undo 'Z' is for redo.
(workspace as WorkspaceSvg).hideChaff();
workspace.undo(false);
e.preventDefault();
return true;
},
keyCodes: [ctrlZ, altZ, metaZ],
Expand Down Expand Up @@ -259,10 +260,11 @@ export function registerRedo() {
preconditionFn(workspace) {
return !Gesture.inProgress() && !workspace.options.readOnly;
},
callback(workspace) {
callback(workspace, e) {
// 'z' for undo 'Z' is for redo.
(workspace as WorkspaceSvg).hideChaff();
workspace.undo(true);
e.preventDefault();
return true;
},
keyCodes: [ctrlShiftZ, altShiftZ, metaShiftZ, ctrlY],
Expand Down

0 comments on commit b13f8f6

Please sign in to comment.