Files
tiptap/packages/vue-2/src/NodeViewWrapper.ts
Dominik 8c6751f0c6 add precommit hook for linting and automatic eslint fixes + update eslint packages (#2862)
* chore: add precommit hook for eslint fixes, fix linting issues
* chore: add eslint import sort plugin
2022-06-08 14:10:25 +02:00

40 lines
745 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,
)
},
}