Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 75bfaa5

Browse files
authored
Merge pull request #5796 from panoschal/fix/save-editor-state-when-reply-is-open
Remember reply when switching rooms
2 parents d5ab780 + 97c7f37 commit 75bfaa5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/components/views/rooms/SendMessageComposer.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,17 @@ export default class SendMessageComposer extends React.Component {
472472
}
473473
}
474474

475+
// should save state when editor has contents or reply is open
476+
_shouldSaveStoredEditorState = () => {
477+
return !this.model.isEmpty || this.props.replyToEvent;
478+
}
479+
475480
_saveStoredEditorState = () => {
476-
if (this.model.isEmpty) {
477-
this._clearStoredEditorState();
478-
} else {
481+
if (this._shouldSaveStoredEditorState()) {
479482
const item = SendHistoryManager.createItem(this.model, this.props.replyToEvent);
480483
localStorage.setItem(this._editorStateKey, JSON.stringify(item));
484+
} else {
485+
this._clearStoredEditorState();
481486
}
482487
}
483488

0 commit comments

Comments
 (0)