File tree 3 files changed +10
-4
lines changed
3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,8 @@ export class EditAction {
51
51
private registerContextMenuAction ( ) {
52
52
const editAboveItem : ContextMenuRegistry . RegistryItem = {
53
53
displayText : 'Edit Block contents (→︎)' ,
54
- preconditionFn : ( scope : ContextMenuRegistry . Scope ) => {
54
+ preconditionFn : ( scope : ContextMenuRegistry . Scope , menuOpenEvent ) => {
55
+ if ( menuOpenEvent instanceof PointerEvent ) return 'hidden' ;
55
56
const workspace = scope . block ?. workspace ;
56
57
if ( ! workspace || ! this . navigation . canCurrentlyNavigate ( workspace ) ) {
57
58
return 'disabled' ;
Original file line number Diff line number Diff line change @@ -71,7 +71,11 @@ export class InsertAction {
71
71
displayText : ( ) => {
72
72
return 'Insert Block (I)' ;
73
73
} ,
74
- preconditionFn : ( scope : ContextMenuRegistry . Scope ) => {
74
+ preconditionFn : (
75
+ scope : ContextMenuRegistry . Scope ,
76
+ menuOpenEvent : Event ,
77
+ ) => {
78
+ if ( menuOpenEvent instanceof PointerEvent ) return 'hidden' ;
75
79
let block ;
76
80
if ( scope . focusedNode instanceof Blockly . Block ) {
77
81
block = scope . focusedNode ;
Original file line number Diff line number Diff line change @@ -127,9 +127,10 @@ export class MoveActions {
127
127
menuItems : ContextMenuRegistry . RegistryItem [ ] = [
128
128
{
129
129
displayText : 'Move Block (M)' ,
130
- preconditionFn : ( scope ) => {
130
+ preconditionFn : ( scope , menuOpenEvent ) => {
131
131
const workspace = scope . block ?. workspace as WorkspaceSvg | null ;
132
- if ( ! workspace ) return 'hidden' ;
132
+ if ( ! workspace || menuOpenEvent instanceof PointerEvent )
133
+ return 'hidden' ;
133
134
return this . mover . canMove ( workspace ) ? 'enabled' : 'disabled' ;
134
135
} ,
135
136
callback : ( scope ) => {
You can’t perform that action at this time.
0 commit comments