diff --git a/client/web/compose/src/views/Admin/Pages/Builder.vue b/client/web/compose/src/views/Admin/Pages/Builder.vue index f2420072be..45bbf101d0 100644 --- a/client/web/compose/src/views/Admin/Pages/Builder.vue +++ b/client/web/compose/src/views/Admin/Pages/Builder.vue @@ -609,6 +609,17 @@ export default { if (this.editor) this.editor = undefined }, + deleteTab ({ blockIndex, tabIndex }) { + const { blockID } = this.blocks[blockIndex] || {} + + if (!blockID) return + + this.unsavedBlocks.add(blockID) + this.blocks[blockIndex].options.tabs.splice(tabIndex, 1) + + this.showUntabbedHiddenBlocks() + }, + // Changes meta.hidden property to false, for all blocks that are hidden but not in a tab showUntabbedHiddenBlocks () { const tabbedBlocks = new Set() @@ -674,7 +685,7 @@ export default { tabbedBlock.meta.hidden = true }) - this.showUnusedHiddenBlocks() + this.showUntabbedHiddenBlocks() } if (this.editor.block.kind === block.kind) { @@ -682,27 +693,6 @@ export default { } }, - showUnusedHiddenBlocks () { - const allTabBlocks = this.blocks.filter(({ kind }) => kind === 'Tabs') - - this.blocks.forEach(block => { - if (!block.meta.hidden) return - - const hiddenBlockID = fetchID(block) - - // Go through all hidden blocks to see if they are tabbed anywhere - const tabbed = allTabBlocks.some(({ options }) => { - const { tabs = [] } = options - return tabs.some(({ blockID }) => blockID === hiddenBlockID) - }) - - if (!tabbed) { - this.calculateNewBlockPosition(block) - block.meta.hidden = false - } - }) - }, - cloneBlock (index) { this.appendBlock(this.blocks[index].clone(), this.$t('notification:page.cloneSuccess')) }, @@ -1074,15 +1064,6 @@ export default { this.$root.$off('tab-createRequest', this.fulfilCreateRequest) this.$root.$off('tabChange', this.untabBlock) }, - - deleteTab ({ blockIndex, tabIndex }) { - const { blockID } = this.blocks[blockIndex] || {} - - if (!blockID) return - - this.unsavedBlocks.add(blockID) - this.blocks[blockIndex].options.tabs.splice(tabIndex, 1) - }, }, }