Skip to content

Commit

Permalink
fix: allow passing props to NodeViewWrapper and NodeViewContent
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkuehn committed Apr 23, 2021
1 parent bd9e15d commit cfb3b80
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
9 changes: 6 additions & 3 deletions packages/react/src/NodeViewContent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'

export interface NodeViewContentProps {
className?: string,
[key: string]: any,
as?: React.ElementType,
}

Expand All @@ -10,9 +10,12 @@ export const NodeViewContent: React.FC<NodeViewContentProps> = props => {

return (
<Tag
className={props.className}
{...props}
data-node-view-content=""
style={{ whiteSpace: 'pre-wrap' }}
style={{
...props.style,
whiteSpace: 'pre-wrap',
}}
/>
)
}
13 changes: 7 additions & 6 deletions packages/react/src/NodeViewWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { useReactNodeView } from './useReactNodeView'

export interface NodeViewWrapperProps {
className?: string,
[key: string]: any,
as?: React.ElementType,
}

Expand All @@ -12,12 +12,13 @@ export const NodeViewWrapper: React.FC<NodeViewWrapperProps> = props => {

return (
<Tag
className={props.className}
{...props}
data-node-view-wrapper=""
onDragStart={onDragStart}
style={{ whiteSpace: 'normal' }}
>
{props.children}
</Tag>
style={{
...props.style,
whiteSpace: 'normal',
}}
/>
)
}

0 comments on commit cfb3b80

Please sign in to comment.