mirror of
https://github.com/google/blockly.git
synced 2026-01-07 09:00:11 +01:00
fix: prevent default undo (#7946)
* fix: prevent default undo * chore: fix format
This commit is contained in:
@@ -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],
|
||||
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user