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