Fix console errors when tab block didn't exist
This commit is contained in:
parent
db42a86bd1
commit
43e343a1f9
@ -6,7 +6,7 @@
|
|||||||
v-on="$listeners"
|
v-on="$listeners"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="!options.tabs.length"
|
v-if="!tabbedBlocks.length"
|
||||||
class="d-flex h-100 align-items-center justify-content-center"
|
class="d-flex h-100 align-items-center justify-content-center"
|
||||||
>
|
>
|
||||||
<p class="mb-0">
|
<p class="mb-0">
|
||||||
@ -48,7 +48,7 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="editable"
|
v-if="tab.block && editable"
|
||||||
class="d-inline ml-3"
|
class="d-inline ml-3"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -115,7 +115,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else-if="!tab.block"
|
||||||
class="d-flex h-100 align-items-center justify-content-center"
|
class="d-flex h-100 align-items-center justify-content-center"
|
||||||
>
|
>
|
||||||
<p class="mb-0">
|
<p class="mb-0">
|
||||||
@ -148,11 +148,15 @@ export default {
|
|||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
tabbedBlocks () {
|
tabbedBlocks () {
|
||||||
return this.block.options.tabs.map(({ blockID, title }) => {
|
return this.block.options.tabs.reduce((acc, { blockID, title }) => {
|
||||||
const unparsedBlock = this.blocks.find(b => fetchID(b) === blockID)
|
const unparsedBlock = blockID ? this.blocks.find(b => fetchID(b) === blockID) : undefined
|
||||||
|
|
||||||
if (!unparsedBlock) {
|
if (!unparsedBlock) {
|
||||||
return { title }
|
if (!blockID && title) {
|
||||||
|
acc.push({ title })
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc
|
||||||
}
|
}
|
||||||
|
|
||||||
let block = JSON.parse(JSON.stringify(unparsedBlock))
|
let block = JSON.parse(JSON.stringify(unparsedBlock))
|
||||||
@ -161,11 +165,14 @@ export default {
|
|||||||
block.style.wrap.kind = 'Plain'
|
block.style.wrap.kind = 'Plain'
|
||||||
block.style.border.enabled = false
|
block.style.border.enabled = false
|
||||||
block = compose.PageBlockMaker(block)
|
block = compose.PageBlockMaker(block)
|
||||||
return {
|
|
||||||
|
acc.push({
|
||||||
block,
|
block,
|
||||||
title,
|
title,
|
||||||
}
|
})
|
||||||
})
|
|
||||||
|
return acc
|
||||||
|
}, [])
|
||||||
},
|
},
|
||||||
|
|
||||||
contentClass () {
|
contentClass () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user