From b0b63b501ed38377bb117880b8cff5f6e435035a Mon Sep 17 00:00:00 2001 From: Emmy Leke Date: Tue, 31 Oct 2023 18:13:42 +0100 Subject: [PATCH] Add indicator to pageblocks when used in several layouts --- client/web/compose/src/components/faIcons.js | 2 + .../compose/src/views/Admin/Pages/Builder.vue | 39 ++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/client/web/compose/src/components/faIcons.js b/client/web/compose/src/components/faIcons.js index 26be6efd2..cc8172590 100644 --- a/client/web/compose/src/components/faIcons.js +++ b/client/web/compose/src/components/faIcons.js @@ -61,6 +61,7 @@ import { faQuestion, faSync, faExclamationTriangle, + faExclamationCircle, faEllipsisV, faLocationArrow, faTools, @@ -176,4 +177,5 @@ library.add( faEllipsisV, faLocationArrow, faTools, + faExclamationCircle, ) diff --git a/client/web/compose/src/views/Admin/Pages/Builder.vue b/client/web/compose/src/views/Admin/Pages/Builder.vue index 342b4878d..909c82109 100644 --- a/client/web/compose/src/views/Admin/Pages/Builder.vue +++ b/client/web/compose/src/views/Admin/Pages/Builder.vue @@ -39,11 +39,13 @@ class="ml-2" /> + + + + tabbedIDs.has(blockID)), ] }, + + otherLayoutBlocks () { + let set + if (!set) { + set = new Set() + } + + return set + }, + + isEditorBlockReferenced () { + if (!this.editor || this.editor.block.blockID === NoID) return + + // All blockIDs in other layouts except this one + const otherLayoutBlockIDs = this.layouts.reduce((acc, { blocks, pageLayoutID }) => { + if (pageLayoutID === this.layout.pageLayoutID) return acc + blocks.forEach(({ blockID }) => acc.add(blockID)) + return acc + }, this.otherLayoutBlocks) + return otherLayoutBlockIDs.has(this.editor.block.blockID) + }, }, watch: {