Files
tiptap/packages/vue-2/src/NodeViewWrapper.ts
Philipp Kühn 0e1d6d41fe refactoring
2021-05-04 11:03:11 +02:00

39 lines
739 B
TypeScript

import Vue, { Component } from 'vue'
export interface NodeViewWrapperInterface extends Vue {
as: string,
decorationClasses: {
value: string,
},
onDragStart: Function,
}
export const NodeViewWrapper: Component = {
props: {
as: {
type: String,
default: 'div',
},
},
inject: ['onDragStart', 'decorationClasses'],
render(this: NodeViewWrapperInterface, createElement) {
return createElement(
this.as, {
class: this.decorationClasses.value,
style: {
whiteSpace: 'normal',
},
attrs: {
'data-node-view-wrapper': '',
},
on: {
dragstart: this.onDragStart,
},
},
this.$slots.default,
)
},
}