@@ -202,23 +202,27 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
202202 timelineRenderingType : this . context . timelineRenderingType ,
203203 } ) ;
204204 } else {
205- this . clearStoredEditorState ( ) ;
206- dis . dispatch ( {
207- action : Action . EditEvent ,
208- event : null ,
209- timelineRenderingType : this . context . timelineRenderingType ,
210- } ) ;
211- dis . dispatch ( {
212- action : Action . FocusSendMessageComposer ,
213- context : this . context . timelineRenderingType ,
214- } ) ;
205+ this . cancelEdit ( ) ;
215206 }
216207 event . preventDefault ( ) ;
217208 break ;
218209 }
219210 }
220211 } ;
221212
213+ private endEdit ( ) : void {
214+ // close the event editing and focus composer
215+ dis . dispatch ( {
216+ action : Action . EditEvent ,
217+ event : null ,
218+ timelineRenderingType : this . context . timelineRenderingType ,
219+ } ) ;
220+ dis . dispatch ( {
221+ action : Action . FocusSendMessageComposer ,
222+ context : this . context . timelineRenderingType ,
223+ } ) ;
224+ }
225+
222226 private get editorRoomKey ( ) : string {
223227 return `mx_edit_room_${ this . getRoom ( ) . roomId } _${ this . context . timelineRenderingType } ` ;
224228 }
@@ -236,15 +240,7 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
236240
237241 private cancelEdit = ( ) : void => {
238242 this . clearStoredEditorState ( ) ;
239- dis . dispatch ( {
240- action : Action . EditEvent ,
241- event : null ,
242- timelineRenderingType : this . context . timelineRenderingType ,
243- } ) ;
244- dis . dispatch ( {
245- action : Action . FocusSendMessageComposer ,
246- context : this . context . timelineRenderingType ,
247- } ) ;
243+ this . endEdit ( ) ;
248244 } ;
249245
250246 private get shouldSaveStoredEditorState ( ) : boolean {
@@ -357,16 +353,7 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
357353 }
358354 }
359355
360- // close the event editing and focus composer
361- dis . dispatch ( {
362- action : Action . EditEvent ,
363- event : null ,
364- timelineRenderingType : this . context . timelineRenderingType ,
365- } ) ;
366- dis . dispatch ( {
367- action : Action . FocusSendMessageComposer ,
368- context : this . context . timelineRenderingType ,
369- } ) ;
356+ this . endEdit ( ) ;
370357 } ;
371358
372359 private cancelPreviousPendingEdit ( ) : void {
0 commit comments