File tree 1 file changed +8
-2
lines changed
app/components/IPRWYSIWYGEditor
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -194,15 +194,21 @@ const IPRWYSIWYGEditor = ({
194
194
}
195
195
} , [ editor , onClose ] ) ;
196
196
197
+ const handleOnClose = useCallback ( ( ) => {
198
+ onClose ( null ) ;
199
+ // Reset the editor text, since we don't deal with the state in React
200
+ editor . commands . setContent ( text ) ;
201
+ } , [ onClose , editor , text ] ) ;
202
+
197
203
return (
198
- < Dialog fullWidth maxWidth = "lg" open = { isOpen } onClose = { ( ) => onClose ( null ) } >
204
+ < Dialog fullWidth maxWidth = "lg" open = { isOpen } onClose = { handleOnClose } >
199
205
< DialogTitle > { title } </ DialogTitle >
200
206
< DialogContent >
201
207
< MenuBar editor = { editor } className = "IPRWYSIWYGEditor__toolbar" />
202
208
< EditorContent editor = { editor } className = "IPRWYSIWYGEditor__content" />
203
209
</ DialogContent >
204
210
< DialogActions >
205
- < Button onClick = { ( ) => onClose ( null ) } > Close</ Button >
211
+ < Button onClick = { handleOnClose } > Close</ Button >
206
212
< Button color = "secondary" onClick = { handleOnSave } > Save</ Button >
207
213
</ DialogActions >
208
214
</ Dialog >
You can’t perform that action at this time.
0 commit comments