mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-22 16:17:50 +08:00
26 lines
557 B
TypeScript
26 lines
557 B
TypeScript
import React from 'react'
|
|
import { useReactNodeView } from './useReactNodeView'
|
|
|
|
export interface NodeViewWrapperProps {
|
|
[key: string]: any,
|
|
as?: React.ElementType,
|
|
}
|
|
|
|
export const NodeViewWrapper: React.FC<NodeViewWrapperProps> = React.forwardRef((props, ref) => {
|
|
const { onDragStart } = useReactNodeView()
|
|
const Tag = props.as || 'div'
|
|
|
|
return (
|
|
<Tag
|
|
{...props}
|
|
ref={ref}
|
|
data-node-view-wrapper=""
|
|
onDragStart={onDragStart}
|
|
style={{
|
|
...props.style,
|
|
whiteSpace: 'normal',
|
|
}}
|
|
/>
|
|
)
|
|
})
|