mirror of
https://github.com/vector-im/element-web.git
synced 2026-01-30 04:41:10 +01:00
force old selection state after creating entities
Fixes vector-im/vector-web#2180
This commit is contained in:
parent
a2904ad33f
commit
ea1419ff78
@ -273,11 +273,15 @@ export function attachImmutableEntitiesToEmoji(editorState: EditorState): Editor
|
||||
});
|
||||
|
||||
if (!newContentState.equals(contentState)) {
|
||||
return EditorState.push(
|
||||
const oldSelection = editorState.getSelection();
|
||||
editorState = EditorState.push(
|
||||
editorState,
|
||||
newContentState,
|
||||
'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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user