Fix remove block (#195)

This commit is contained in:
formsdev 2023-09-08 19:35:56 +05:30 committed by GitHub
parent 7119ec2304
commit f82a8afe79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -294,10 +294,10 @@ export default {
this.$store.commit('open/working_form/openSettingsForField', this.formFields.length-1) this.$store.commit('open/working_form/openSettingsForField', this.formFields.length-1)
}, },
removeBlock(blockIndex) { removeBlock(blockIndex) {
this.closeSidebar()
const newFields = clonedeep(this.formFields) const newFields = clonedeep(this.formFields)
newFields.splice(blockIndex, 1) newFields.splice(blockIndex, 1)
this.$set(this, 'formFields', newFields) this.$set(this, 'formFields', newFields)
this.closeSidebar()
}, },
closeSidebar() { closeSidebar() {
this.$store.commit('open/working_form/closeEditFieldSidebar') this.$store.commit('open/working_form/closeEditFieldSidebar')

View File

@ -121,18 +121,18 @@ export default {
this.$set(this.field, 'type', newType) this.$set(this.field, 'type', newType)
}, },
removeBlock() { removeBlock() {
this.closeSidebar()
const newFields = clonedeep(this.form.properties) const newFields = clonedeep(this.form.properties)
newFields.splice(this.selectedFieldIndex, 1) newFields.splice(this.selectedFieldIndex, 1)
this.$set(this.form, 'properties', newFields) this.$set(this.form, 'properties', newFields)
this.closeSidebar()
}, },
duplicateBlock() { duplicateBlock() {
this.closeSidebar()
const newFields = clonedeep(this.form.properties) const newFields = clonedeep(this.form.properties)
const newField = clonedeep(this.form.properties[this.selectedFieldIndex]) const newField = clonedeep(this.form.properties[this.selectedFieldIndex])
newField.id = this.generateUUID() newField.id = this.generateUUID()
newFields.push(newField) newFields.push(newField)
this.$set(this.form, 'properties', newFields) this.$set(this.form, 'properties', newFields)
this.closeSidebar()
}, },
closeSidebar() { closeSidebar() {
this.$store.commit('open/working_form/closeEditFieldSidebar') this.$store.commit('open/working_form/closeEditFieldSidebar')