Skip to content

Commit

Permalink
fix(react): reset initialized when editorcontent is unmounting (ueber…
Browse files Browse the repository at this point in the history
…dosis#3781)

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

* style: remove unneeded if statement
  • Loading branch information
bdbch authored Feb 27, 2023
1 parent df64839 commit 658839f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/EditorContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -117,6 +113,8 @@ export class PureEditorContent extends React.Component<EditorContentProps, Edito
return
}

this.initialized = false

if (!editor.isDestroyed) {
editor.view.setProps({
nodeViews: {},
Expand Down

0 comments on commit 658839f

Please sign in to comment.