-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
f9493c2
commit dead826
Showing
3 changed files
with
18 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,24 @@ | ||
import React, { useEffect } from 'react' | ||
import React from 'react' | ||
import { useReactNodeView } from './useReactNodeView' | ||
|
||
export interface NodeViewContentProps { | ||
[key: string]: any, | ||
as?: React.ElementType, | ||
} | ||
|
||
export const NodeViewContent: React.FC<NodeViewContentProps> = React.forwardRef((props, ref) => { | ||
export const NodeViewContent: React.FC<NodeViewContentProps> = props => { | ||
const Tag = props.as || 'div' | ||
const { maybeMoveContentDOM } = useReactNodeView() | ||
|
||
useEffect(() => { | ||
maybeMoveContentDOM?.() | ||
}, []) | ||
const { nodeViewContentRef } = useReactNodeView() | ||
|
||
return ( | ||
<Tag | ||
{...props} | ||
ref={ref} | ||
ref={nodeViewContentRef} | ||
data-node-view-content="" | ||
style={{ | ||
...props.style, | ||
whiteSpace: 'pre-wrap', | ||
}} | ||
/> | ||
) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters