From a2eca42fb8d043114934017d809d6873009cb9d6 Mon Sep 17 00:00:00 2001 From: Jed Date: Tue, 31 Dec 2024 16:48:49 +0100 Subject: [PATCH] allows to pass type to doc context menu to use for operations --- .../doc-type/ui/apos/logic/AposDocContextMenu.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/@apostrophecms/doc-type/ui/apos/logic/AposDocContextMenu.js b/modules/@apostrophecms/doc-type/ui/apos/logic/AposDocContextMenu.js index 6ff136e512..ab47e86a1a 100644 --- a/modules/@apostrophecms/doc-type/ui/apos/logic/AposDocContextMenu.js +++ b/modules/@apostrophecms/doc-type/ui/apos/logic/AposDocContextMenu.js @@ -12,6 +12,10 @@ export default { type: Object, required: true }, + type: { + type: String, + default: null + }, // If editing in a modal, pass the current value object from the editor here // so that the visibility of options takes unsaved changes into account current: { @@ -207,7 +211,8 @@ export default { ifProps = ifProps || {}; moduleIf = moduleIf || {}; - const canSeeOperation = checkIfConditions(this.doc, ifProps) && checkIfConditions(this.moduleOptions, moduleIf); + const canSeeOperation = checkIfConditions(this.doc, ifProps) && + checkIfConditions(this.moduleOptions, moduleIf); if (!canSeeOperation) { return false; @@ -217,11 +222,13 @@ export default { }); }, moduleName() { + if (this.type) { + return this.type; + } if (apos.modules[this.context.type].action === apos.modules['@apostrophecms/page'].action) { return '@apostrophecms/page'; - } else { - return this.context.type; } + return this.context.type; }, moduleOptions() { return apos.modules[this.moduleName];