mirror of https://github.com/vector-im/riot-web
Merge pull request #488 from aviraldg/fix-2180
force old selection state after creating entitiespull/21833/head
commit
c228fac6d9
|
@ -273,11 +273,15 @@ export function attachImmutableEntitiesToEmoji(editorState: EditorState): Editor
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!newContentState.equals(contentState)) {
|
if (!newContentState.equals(contentState)) {
|
||||||
return EditorState.push(
|
const oldSelection = editorState.getSelection();
|
||||||
|
editorState = EditorState.push(
|
||||||
editorState,
|
editorState,
|
||||||
newContentState,
|
newContentState,
|
||||||
'convert-to-immutable-emojis',
|
'convert-to-immutable-emojis',
|
||||||
);
|
);
|
||||||
|
// this is somewhat of a hack, we're undoing selection changes caused above
|
||||||
|
// it would be better not to make those changes in the first place
|
||||||
|
editorState = EditorState.forceSelection(editorState, oldSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
return editorState;
|
return editorState;
|
||||||
|
|
Loading…
Reference in New Issue