File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ const Composer = ({
76
76
customInitOptions,
77
77
...rest
78
78
} : ComposerProps ) : React . JSX . Element => {
79
+ const isControlledMode = useMemo ( ( ) => ! ! onEditorChange , [ onEditorChange ] ) ;
80
+
79
81
const _onEditorChange = useCallback < NonNullable < EditorProps [ 'onEditorChange' ] > > (
80
82
( newContent , editor ) => {
81
83
onEditorChange ?.( [
@@ -85,6 +87,7 @@ const Composer = ({
85
87
} ,
86
88
[ onEditorChange ]
87
89
) ;
90
+
88
91
const { prefs } = useUserSettings ( ) ;
89
92
const defaultStyle = useMemo (
90
93
( ) => ( {
@@ -271,7 +274,7 @@ const Composer = ({
271
274
initialValue = { initialValue }
272
275
value = { value }
273
276
init = { editorInitConfig }
274
- onEditorChange = { _onEditorChange }
277
+ onEditorChange = { isControlledMode ? _onEditorChange : undefined }
275
278
{ ...rest }
276
279
/>
277
280
</ Container >
You can’t perform that action at this time.
0 commit comments