refactoring
This commit is contained in:
@@ -5,26 +5,12 @@ export default {
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
unwrap(element) {
|
||||
const parent = element.parentNode
|
||||
|
||||
while (element.firstChild) {
|
||||
parent.insertBefore(element.firstChild, element)
|
||||
}
|
||||
|
||||
parent.removeChild(element)
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'editor.element': {
|
||||
immediate: true,
|
||||
handler(element) {
|
||||
if (element) {
|
||||
this.$nextTick(() => {
|
||||
this.$el.append(element)
|
||||
this.unwrap(element)
|
||||
})
|
||||
this.$nextTick(() => this.$el.append(element.firstChild))
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user