fix(react): reset initialized when editorcontent is unmounting (#3781)

* fix(react): reset initialized when editorcontent is unmounting

* style: remove unneeded if statement
This commit is contained in:
Dominik 2023-02-27 19:33:42 +01:00 committed by GitHub
parent acf186d2ac
commit 38b7e412bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,22 +8,18 @@ const Portals: React.FC<{ renderers: Record<string, ReactRenderer> }> = ({ rende
return (
<>
{Object.entries(renderers).map(([key, renderer]) => {
return ReactDOM.createPortal(
renderer.reactElement,
renderer.element,
key,
)
return ReactDOM.createPortal(renderer.reactElement, renderer.element, key)
})}
</>
)
}
export interface EditorContentProps extends HTMLProps<HTMLDivElement> {
editor: Editor | null,
editor: Editor | null;
}
export interface EditorContentState {
renderers: Record<string, ReactRenderer>
renderers: Record<string, ReactRenderer>;
}
export class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {
@ -117,6 +113,8 @@ export class PureEditorContent extends React.Component<EditorContentProps, Edito
return
}
this.initialized = false
if (!editor.isDestroyed) {
editor.view.setProps({
nodeViews: {},