Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kelanik8 committed Mar 8, 2024
1 parent 5301484 commit 4fc9322
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
class="w-100"
>


<b-col
v-if="selectableNamespaceGlobalBlocks.length"
cols="12"
Expand Down Expand Up @@ -291,7 +290,7 @@ export default {
}
return this.existingLayoutBlocks.find((b) => b.blockID === blockID)
}
},
},
}
</script>
55 changes: 27 additions & 28 deletions client/web/compose/src/views/Admin/Pages/Builder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ export default {
selectableNamespaceGlobalBlocks () {
const { namespaceID } = this.namespace
const namespace = this.namespaces.find((n) => n.namespaceID === namespaceID);
const namespace = this.namespaces.find((n) => n.namespaceID === namespaceID)
if (!namespace) {
return []
Expand Down Expand Up @@ -1180,35 +1180,34 @@ export default {
const { blocks = [] } = this.layout || {}
const { namespaceID } = this.namespace
blocks.forEach(({ blockID, xywh, meta = {} }) => {
if (blockID) {
let block = cloneDeep(this.fetchBlockData({
blockID,
meta,
}))
block.blockID = meta.namespaceID ? `${namespaceID}-${block.blockID}` : block.blockID
if (block) {
block.xywh = xywh
block.meta.hidden = !!meta.hidden
tempBlocks.push(block)
if (block.kind === 'Tabs') {
const { tabs = [] } = block.options
tabs.forEach(tab => {
if (blocks.some(b => b.blockID === tab.blockID)) return
// global blocks are not added to tabs, it's unnecessary
block = this.page.blocks.find(b => b.blockID === tab.blockID)
if (block) {
tempBlocks.push(block)
}
})
}
let block = cloneDeep(this.fetchBlockData({
blockID,
meta,
}))
block.blockID = meta.namespaceID ? `${namespaceID}-${block.blockID}` : block.blockID
if (block) {
block.xywh = xywh
block.meta.hidden = !!meta.hidden
tempBlocks.push(block)
if (block.kind === 'Tabs') {
const { tabs = [] } = block.options
tabs.forEach(tab => {
if (blocks.some(b => b.blockID === tab.blockID)) return
// global blocks are not added to tabs, it's unnecessary
block = this.page.blocks.find(b => b.blockID === tab.blockID)
if (block) {
tempBlocks.push(block)
}
})
}
}
}
})
Expand Down Expand Up @@ -1256,7 +1255,7 @@ export default {
blockID = fetchID({ blockID, meta })
if (meta.namespaceID) {
const namespace = this.namespaces.find((n) => n.namespaceID === this.namespace.namespaceID);
const namespace = this.namespaces.find((n) => n.namespaceID === this.namespace.namespaceID)
if (namespace) {
return namespace.blocks.find((b) => fetchID(b) === blockID)
Expand Down
2 changes: 1 addition & 1 deletion client/web/compose/src/views/Public/Pages/View.vue
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export default {
this.blocks = (this.layout || {}).blocks.map(({ blockID, meta, xywh }) => {
const block = this.fetchBlockData({
blockID,
meta
meta,
})
block.xywh = xywh
Expand Down

0 comments on commit 4fc9322

Please sign in to comment.