File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 44 * SPDX-License-Identifier: Apache-2.0
55 */
66
7- import { ShortcutRegistry , ShortcutItems , WorkspaceSvg } from 'blockly/core' ;
7+ import {
8+ ContextMenuRegistry ,
9+ ShortcutRegistry ,
10+ ShortcutItems ,
11+ WorkspaceSvg ,
12+ } from 'blockly/core' ;
813
914/**
1015 * Class for registering a shortcut for undo/redo actions.
@@ -22,9 +27,12 @@ export class UndoRedoAction {
2227 this . originalUndo = undo ;
2328 const patchedUndo = {
2429 ...this . originalUndo ,
25- preconditionFn : ( workspace : WorkspaceSvg ) => {
30+ preconditionFn : (
31+ workspace : WorkspaceSvg ,
32+ scope : ContextMenuRegistry . Scope ,
33+ ) => {
2634 return ! ! (
27- ! workspace . isDragging ( ) && undo . preconditionFn ?.( workspace )
35+ ! workspace . isDragging ( ) && undo . preconditionFn ?.( workspace , scope )
2836 ) ;
2937 } ,
3038 allowCollision : true ,
@@ -39,9 +47,12 @@ export class UndoRedoAction {
3947 this . originalRedo = redo ;
4048 const patchedRedo = {
4149 ...this . originalRedo ,
42- preconditionFn : ( workspace : WorkspaceSvg ) => {
50+ preconditionFn : (
51+ workspace : WorkspaceSvg ,
52+ scope : ContextMenuRegistry . Scope ,
53+ ) => {
4354 return ! ! (
44- ! workspace . isDragging ( ) && redo . preconditionFn ?.( workspace )
55+ ! workspace . isDragging ( ) && redo . preconditionFn ?.( workspace , scope )
4556 ) ;
4657 } ,
4758 allowCollision : true ,
You can’t perform that action at this time.
0 commit comments