Files
tiptap/packages/react/src/NodeViewWrapper.tsx
Philipp Kühn 56aaf75db5 refactoring
2021-03-14 22:41:25 +01:00

22 lines
468 B
TypeScript

import React from 'react'
import { useReactNodeView } from './useReactNodeView'
export interface NodeViewWrapperProps {
as: React.ElementType
}
export const NodeViewWrapper: React.FC<NodeViewWrapperProps> = props => {
const { onDragStart } = useReactNodeView()
const Tag = props.as || 'div'
return (
<Tag
data-node-view-wrapper=""
onDragStart={onDragStart}
style={{ whiteSpace: 'normal' }}
>
{props.children}
</Tag>
)
}