mirror of
https://github.com/suren-atoyan/monaco-react.git
synced 2026-01-18 15:54:45 +00:00
check editor existence in 'removeEditor' function
This commit is contained in:
parent
509ea798da
commit
e61d021e5e
@ -102,7 +102,7 @@ const DiffEditor =
|
||||
!isMonacoMounting && !isEditorReady && createEditor();
|
||||
}, [isMonacoMounting, isEditorReady, createEditor]);
|
||||
|
||||
const removeEditor = _ => editorRef.current.dispose();
|
||||
const removeEditor = _ => editorRef.current && editorRef.current.dispose();
|
||||
|
||||
return (
|
||||
<section style={{ ...styles.wrapper, width, height }}>
|
||||
|
||||
@ -76,7 +76,7 @@ const Editor =
|
||||
!isMonacoMounting && !isEditorReady && createEditor();
|
||||
}, [isMonacoMounting, isEditorReady, createEditor]);
|
||||
|
||||
const removeEditor = _ => editorRef.current.dispose();
|
||||
const removeEditor = _ => editorRef.current && editorRef.current.dispose();
|
||||
|
||||
return (
|
||||
<section style={{ ...styles.wrapper, width, height }}>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user