tiptap/packages/react/src/NodeViewContent.tsx

25 lines
459 B
TypeScript
Raw Normal View History

2021-03-14 23:30:06 +08:00
import React from 'react'
2021-03-15 04:45:14 +08:00
export interface NodeViewContentProps {
[key: string]: any,
2021-04-08 15:11:45 +08:00
as?: React.ElementType,
2021-03-15 04:45:14 +08:00
}
2021-06-11 14:06:44 +08:00
export const NodeViewContent: React.FC<NodeViewContentProps> =
React.forwardRef((props, ref) => {
const Tag = props.as || 'div'
2021-03-15 04:45:14 +08:00
2021-06-11 14:06:44 +08:00
return (
<Tag
{...props}
ref={ref}
data-node-view-content=""
style={{
...props.style,
whiteSpace: 'pre-wrap',
}}
/>
)
2021-06-11 14:33:22 +08:00
})