diff --git a/src/actions/edit.ts b/src/actions/edit.ts index f2c0bd9c..ef8f34e8 100644 --- a/src/actions/edit.ts +++ b/src/actions/edit.ts @@ -51,7 +51,8 @@ export class EditAction { private registerContextMenuAction() { const editAboveItem: ContextMenuRegistry.RegistryItem = { displayText: 'Edit Block contents (→︎)', - preconditionFn: (scope: ContextMenuRegistry.Scope) => { + preconditionFn: (scope: ContextMenuRegistry.Scope, menuOpenEvent) => { + if (menuOpenEvent instanceof PointerEvent) return 'hidden'; const workspace = scope.block?.workspace; if (!workspace || !this.navigation.canCurrentlyNavigate(workspace)) { return 'disabled'; diff --git a/src/actions/insert.ts b/src/actions/insert.ts index aece7712..a7107879 100644 --- a/src/actions/insert.ts +++ b/src/actions/insert.ts @@ -71,7 +71,11 @@ export class InsertAction { displayText: () => { return 'Insert Block (I)'; }, - preconditionFn: (scope: ContextMenuRegistry.Scope) => { + preconditionFn: ( + scope: ContextMenuRegistry.Scope, + menuOpenEvent: Event, + ) => { + if (menuOpenEvent instanceof PointerEvent) return 'hidden'; let block; if (scope.focusedNode instanceof Blockly.Block) { block = scope.focusedNode; diff --git a/src/actions/move.ts b/src/actions/move.ts index 51a7c42e..d9c0e413 100644 --- a/src/actions/move.ts +++ b/src/actions/move.ts @@ -127,9 +127,10 @@ export class MoveActions { menuItems: ContextMenuRegistry.RegistryItem[] = [ { displayText: 'Move Block (M)', - preconditionFn: (scope) => { + preconditionFn: (scope, menuOpenEvent) => { const workspace = scope.block?.workspace as WorkspaceSvg | null; - if (!workspace) return 'hidden'; + if (!workspace || menuOpenEvent instanceof PointerEvent) + return 'hidden'; return this.mover.canMove(workspace) ? 'enabled' : 'disabled'; }, callback: (scope) => {