add NodeViewWrapper and NodeViewContent component

This commit is contained in:
Philipp Kühn
2021-03-05 00:02:28 +01:00
parent a997b647f4
commit 3bf900e7f6
5 changed files with 89 additions and 75 deletions

View File

@@ -0,0 +1,25 @@
import { h, defineComponent } from 'vue'
export const NodeViewContent = defineComponent({
props: {
as: {
type: String,
default: 'div',
},
},
inject: ['editable'],
render() {
return h(
this.as, {
style: {
whiteSpace: 'pre-wrap',
},
'data-node-view-content': '',
// @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)
contenteditable: this.editable.value,
},
)
},
})