File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,8 @@ export class EditAction {
5151 private registerContextMenuAction ( ) {
5252 const editAboveItem : ContextMenuRegistry . RegistryItem = {
5353 displayText : 'Edit Block contents (→︎)' ,
54- preconditionFn : ( scope : ContextMenuRegistry . Scope ) => {
54+ preconditionFn : ( scope : ContextMenuRegistry . Scope , menuOpenEvent ) => {
55+ if ( menuOpenEvent instanceof PointerEvent ) return 'hidden' ;
5556 const workspace = scope . block ?. workspace ;
5657 if ( ! workspace || ! this . navigation . canCurrentlyNavigate ( workspace ) ) {
5758 return 'disabled' ;
Original file line number Diff line number Diff line change @@ -71,7 +71,11 @@ export class InsertAction {
7171 displayText : ( ) => {
7272 return 'Insert Block (I)' ;
7373 } ,
74- preconditionFn : ( scope : ContextMenuRegistry . Scope ) => {
74+ preconditionFn : (
75+ scope : ContextMenuRegistry . Scope ,
76+ menuOpenEvent : Event ,
77+ ) => {
78+ if ( menuOpenEvent instanceof PointerEvent ) return 'hidden' ;
7579 let block ;
7680 if ( scope . focusedNode instanceof Blockly . Block ) {
7781 block = scope . focusedNode ;
Original file line number Diff line number Diff line change @@ -127,9 +127,10 @@ export class MoveActions {
127127 menuItems : ContextMenuRegistry . RegistryItem [ ] = [
128128 {
129129 displayText : 'Move Block (M)' ,
130- preconditionFn : ( scope ) => {
130+ preconditionFn : ( scope , menuOpenEvent ) => {
131131 const workspace = scope . block ?. workspace as WorkspaceSvg | null ;
132- if ( ! workspace ) return 'hidden' ;
132+ if ( ! workspace || menuOpenEvent instanceof PointerEvent )
133+ return 'hidden' ;
133134 return this . mover . canMove ( workspace ) ? 'enabled' : 'disabled' ;
134135 } ,
135136 callback : ( scope ) => {
You can’t perform that action at this time.
0 commit comments