When showing thread, always auto-focus its composer (#8115)

This commit is contained in:
Michael Telatynski 2022-03-23 10:54:40 +00:00 committed by GitHub
parent a8d65ab5c5
commit d9276426fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 34 deletions

View file

@ -202,16 +202,7 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
timelineRenderingType: this.context.timelineRenderingType,
});
} else {
this.clearStoredEditorState();
dis.dispatch({
action: Action.EditEvent,
event: null,
timelineRenderingType: this.context.timelineRenderingType,
});
dis.dispatch({
action: Action.FocusSendMessageComposer,
context: this.context.timelineRenderingType,
});
this.cancelEdit();
}
event.preventDefault();
break;
@ -219,6 +210,19 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
}
};
private endEdit(): void {
// close the event editing and focus composer
dis.dispatch({
action: Action.EditEvent,
event: null,
timelineRenderingType: this.context.timelineRenderingType,
});
dis.dispatch({
action: Action.FocusSendMessageComposer,
context: this.context.timelineRenderingType,
});
}
private get editorRoomKey(): string {
return `mx_edit_room_${this.getRoom().roomId}_${this.context.timelineRenderingType}`;
}
@ -236,15 +240,7 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
private cancelEdit = (): void => {
this.clearStoredEditorState();
dis.dispatch({
action: Action.EditEvent,
event: null,
timelineRenderingType: this.context.timelineRenderingType,
});
dis.dispatch({
action: Action.FocusSendMessageComposer,
context: this.context.timelineRenderingType,
});
this.endEdit();
};
private get shouldSaveStoredEditorState(): boolean {
@ -357,16 +353,7 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
}
}
// close the event editing and focus composer
dis.dispatch({
action: Action.EditEvent,
event: null,
timelineRenderingType: this.context.timelineRenderingType,
});
dis.dispatch({
action: Action.FocusSendMessageComposer,
context: this.context.timelineRenderingType,
});
this.endEdit();
};
private cancelPreviousPendingEdit(): void {