move component to vue package

This commit is contained in:
Philipp Kühn
2020-03-27 22:55:26 +01:00
parent d0973a8f21
commit 88806db558
9 changed files with 48 additions and 19 deletions

View File

@@ -1,3 +1 @@
export default function() {
return 2
}
export { default as EditorContent } from './src/components/EditorContent'

View File

@@ -10,5 +10,8 @@
"files": [
"src",
"dist"
]
],
"peerDependencies": {
"vue": "2.x"
}
}

View File

@@ -0,0 +1,32 @@
import Vue from 'vue'
export default Vue.extend({
props: {
editor: {
default: null,
type: Object,
},
},
watch: {
editor: {
immediate: true,
handler(editor) {
if (editor && editor.element) {
this.$nextTick(() => {
this.$el.appendChild(editor.element.firstChild)
// editor.setParentComponent(this)
})
}
},
},
},
render(createElement) {
return createElement('div')
},
beforeDestroy() {
this.editor.element = this.$el
},
})