3
0

Fix new block y position

This commit is contained in:
Jože Fortun
2023-04-20 13:57:38 +02:00
parent 6103a15791
commit a5a95e1627
2 changed files with 15 additions and 2 deletions

View File

@@ -125,8 +125,8 @@ export default {
return meta.hidden ? { i, x: 0, y: 0, w: 0, h: 0 } : { i, x, y, w, h }
})
// Only use next tick if previous layout exists
if (this.layout.length) {
// Only use next tick if previous layout exists and not editing
if (this.layout.length && !this.editable) {
this.layout = []
// Next tick is important, otherwise it can lead to overlapping blocks

View File

@@ -526,6 +526,7 @@ export default {
addBlock (block, index = undefined) {
this.$bvModal.hide('createBlockSelector')
this.calculateNewBlockPosition(block)
this.editor = { index, block: compose.PageBlockMaker(block) }
},
@@ -604,6 +605,7 @@ export default {
} else {
this.blocks.push(block)
this.unsavedBlocks.add(this.blocks.length - 1)
this.scrollToBottom()
}
if (block.kind === 'Tabs') {
@@ -912,6 +914,17 @@ export default {
this.$refs.layoutSelect.localValue = this.layout.pageLayoutID
})
},
scrollToBottom () {
const pageBuilderElement = document.getElementById('page-builder')
this.$nextTick(() => {
pageBuilderElement.scrollTo({
top: pageBuilderElement.scrollHeight,
behavior: 'smooth',
})
})
},
},
}
</script>