Skip to content

Commit

Permalink
fix: prevent default undo
Browse files Browse the repository at this point in the history
  • Loading branch information
BeksOmega committed Mar 20, 2024
1 parent 2ff7ffd commit 9f0f51c
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 @@ -216,10 +216,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 @@ -254,10 +255,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 9f0f51c

Please sign in to comment.