Files
tiptap/packages/react/src/NodeViewWrapper.tsx
2021-03-18 09:38:10 +01:00

24 lines
525 B
TypeScript

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