mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 22:36:14 +08:00
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:
parent
acf186d2ac
commit
38b7e412bb
@ -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: {},
|
||||
|
Loading…
Reference in New Issue
Block a user