mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-01 10:27:06 +03:00
Fix issue where the cursor is put at the start of selected history item
Leading to strange behaviour when selecting all and deleting it. Fixes https://github.com/vector-im/riot-web/issues/4450
This commit is contained in:
parent
bcb67bb273
commit
d696373bc2
1 changed files with 8 additions and 0 deletions
|
@ -568,6 +568,14 @@ export default class MessageComposerInput extends React.Component {
|
||||||
'insert-characters',
|
'insert-characters',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Move selection to the end of the selected history
|
||||||
|
let newSelection = SelectionState.createEmpty(newContent.getLastBlock().getKey());
|
||||||
|
newSelection = newSelection.merge({
|
||||||
|
focusOffset: newContent.getLastBlock().getLength(),
|
||||||
|
anchorOffset: newContent.getLastBlock().getLength(),
|
||||||
|
});
|
||||||
|
editorState = EditorState.forceSelection(editorState, newSelection);
|
||||||
|
|
||||||
this.setState({editorState});
|
this.setState({editorState});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue