fix: fix a bug when using nested node views in react, fix #1747

This commit is contained in:
Philipp Kühn
2021-08-24 22:13:18 +02:00
parent fa393d8245
commit b15a8a8683
3 changed files with 10 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import React from 'react'
import React, { useEffect } from 'react'
import { useReactNodeView } from './useReactNodeView'
export interface NodeViewContentProps {
[key: string]: any,
@@ -7,6 +8,11 @@ export interface NodeViewContentProps {
export const NodeViewContent: React.FC<NodeViewContentProps> = React.forwardRef((props, ref) => {
const Tag = props.as || 'div'
const { maybeMoveContentDOM } = useReactNodeView()
useEffect(() => {
maybeMoveContentDOM?.()
}, [])
return (
<Tag