diff --git a/packages/app/constants/menu-contexts.js b/packages/app/constants/menu-contexts.js index 9a24b2b5..58dc679f 100755 --- a/packages/app/constants/menu-contexts.js +++ b/packages/app/constants/menu-contexts.js @@ -11,6 +11,9 @@ function copyToClipboard(text) { } export default { + "ignore": () => { + return false + }, "postCard-context": (parent, element, control) => { const items = [ { diff --git a/packages/app/src/cores/contextMenu/index.js b/packages/app/src/cores/contextMenu/index.js index dcb336d9..1dfeb5f2 100755 --- a/packages/app/src/cores/contextMenu/index.js +++ b/packages/app/src/cores/contextMenu/index.js @@ -66,6 +66,10 @@ export default class ContextMenuCore extends Core { } } + if (!items) { + return null + } + // fullfill each item with a correspondent index if missing declared items = items.map((item, index) => { if (!item.index) { @@ -104,13 +108,20 @@ export default class ContextMenuCore extends Core { return } + const items = this.generateItems(component) + + if (!items) { + console.warn("No context menu items found, aborting") + return false + } + this.show({ cords: { x, y, }, clickedComponent: component, - items: this.generateItems(component), + items: items, }) }