diff --git a/packages/react/src/EditorContent.tsx b/packages/react/src/EditorContent.tsx index df40df3197..82ed3b9220 100644 --- a/packages/react/src/EditorContent.tsx +++ b/packages/react/src/EditorContent.tsx @@ -148,13 +148,13 @@ export class PureEditorContent extends React.Component { +const EditorContentWithKey = React.forwardRef((props: EditorContentProps, ref: React.ForwardedRef) => { const key = React.useMemo(() => { return Math.floor(Math.random() * 0xFFFFFFFF).toString() }, [props.editor]) // Can't use JSX here because it conflicts with the type definition of Vue's JSX, so use createElement - return React.createElement(PureEditorContent, { key, ...props }) -} + return React.createElement(PureEditorContent, { key, ref, ...props }) +}) export const EditorContent = React.memo(EditorContentWithKey)