From cbe5944ff0c2339253c175121ba8fcc80313e257 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 16 Jul 2018 22:04:42 +0100 Subject: [PATCH] preserve selection and history between room changes and refreshes Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/stores/MessageComposerStore.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/stores/MessageComposerStore.js b/src/stores/MessageComposerStore.js index 0b22057f3c..f180d931bf 100644 --- a/src/stores/MessageComposerStore.js +++ b/src/stores/MessageComposerStore.js @@ -32,7 +32,12 @@ class MessageComposerStore { setEditorState(roomId: string, editorState: Value, richText: boolean) { localStorage.setItem(this._getKey(roomId), JSON.stringify({ - editor_state: editorState, + editor_state: editorState.toJSON({ + preserveSelection: true, + preserveHistory: true, + // XXX: this seems like a workaround for selection.isSet being based on anchorKey instead of anchorPath + preserveKeys: true, + }), rich_text: richText, })); }