We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a6c9c48 commit e49a204Copy full SHA for e49a204
src/store/integrations/composer.tsx
@@ -76,6 +76,8 @@ const Composer = ({
76
customInitOptions,
77
...rest
78
}: ComposerProps): React.JSX.Element => {
79
+ const isControlledMode = useMemo(() => !!onEditorChange, [onEditorChange]);
80
+
81
const _onEditorChange = useCallback<NonNullable<EditorProps['onEditorChange']>>(
82
(newContent, editor) => {
83
onEditorChange?.([
@@ -85,6 +87,7 @@ const Composer = ({
85
87
},
86
88
[onEditorChange]
89
);
90
91
const { prefs } = useUserSettings();
92
const defaultStyle = useMemo(
93
() => ({
@@ -271,7 +274,7 @@ const Composer = ({
271
274
initialValue={initialValue}
272
275
value={value}
273
276
init={editorInitConfig}
- onEditorChange={_onEditorChange}
277
+ onEditorChange={isControlledMode ? _onEditorChange : undefined}
278
{...rest}
279
/>
280
</Container>
0 commit comments