mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-08-06 13:38:49 +08:00
NodeViewWrapper forwardRef
This commit is contained in:
parent
2502932fa0
commit
83525ec4f1
@ -6,19 +6,22 @@ export interface NodeViewWrapperProps {
|
||||
as?: React.ElementType,
|
||||
}
|
||||
|
||||
export const NodeViewWrapper: React.FC<NodeViewWrapperProps> = props => {
|
||||
const { onDragStart } = useReactNodeView()
|
||||
const Tag = props.as || 'div'
|
||||
export const NodeViewWrapper: React.FC<NodeViewWrapperProps> =
|
||||
React.forwardRef((props, ref) => {
|
||||
const { onDragStart } = useReactNodeView()
|
||||
const Tag = props.as || 'div'
|
||||
|
||||
return (
|
||||
<Tag
|
||||
{...props}
|
||||
data-node-view-wrapper=""
|
||||
onDragStart={onDragStart}
|
||||
style={{
|
||||
...props.style,
|
||||
whiteSpace: 'normal',
|
||||
}}
|
||||
/>
|
||||
)
|
||||
return (
|
||||
<Tag
|
||||
{...props}
|
||||
ref={ref}
|
||||
data-node-view-wrapper=""
|
||||
onDragStart={onDragStart}
|
||||
style={{
|
||||
...props.style,
|
||||
whiteSpace: 'normal',
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user