Fix dismissing edit composer when change was undone (#9109)
* Fix dismissing edit composer when change was undone * Add tests
This commit is contained in:
parent
27ba1e57e6
commit
6796375b10
2 changed files with 73 additions and 7 deletions
|
@ -213,6 +213,9 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
|
|||
};
|
||||
|
||||
private endEdit(): void {
|
||||
localStorage.removeItem(this.editorRoomKey);
|
||||
localStorage.removeItem(this.editorStateKey);
|
||||
|
||||
// close the event editing and focus composer
|
||||
dis.dispatch({
|
||||
action: Action.EditEvent,
|
||||
|
@ -241,7 +244,6 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
|
|||
}
|
||||
|
||||
private cancelEdit = (): void => {
|
||||
this.clearStoredEditorState();
|
||||
this.endEdit();
|
||||
};
|
||||
|
||||
|
@ -262,11 +264,6 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
|
|||
}
|
||||
}
|
||||
|
||||
private clearStoredEditorState(): void {
|
||||
localStorage.removeItem(this.editorRoomKey);
|
||||
localStorage.removeItem(this.editorStateKey);
|
||||
}
|
||||
|
||||
private clearPreviousEdit(): void {
|
||||
if (localStorage.getItem(this.editorRoomKey)) {
|
||||
localStorage.removeItem(`mx_edit_state_${localStorage.getItem(this.editorRoomKey)}`);
|
||||
|
@ -354,7 +351,6 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
|
|||
const threadId = event.threadRootId || null;
|
||||
|
||||
this.props.mxClient.sendMessage(roomId, threadId, editContent);
|
||||
this.clearStoredEditorState();
|
||||
dis.dispatch({ action: "message_sent" });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue