mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-27 11:27:49 +08:00
25 lines
524 B
TypeScript
25 lines
524 B
TypeScript
import React from 'react'
|
|
import { useReactNodeView } from './useReactNodeView'
|
|
|
|
export interface NodeViewContentProps {
|
|
[key: string]: any,
|
|
as?: React.ElementType,
|
|
}
|
|
|
|
export const NodeViewContent: React.FC<NodeViewContentProps> = props => {
|
|
const Tag = props.as || 'div'
|
|
const { nodeViewContentRef } = useReactNodeView()
|
|
|
|
return (
|
|
<Tag
|
|
{...props}
|
|
ref={nodeViewContentRef}
|
|
data-node-view-content=""
|
|
style={{
|
|
...props.style,
|
|
whiteSpace: 'pre-wrap',
|
|
}}
|
|
/>
|
|
)
|
|
}
|