take edge into consideration when moving focus region on arrow keys

fixes: >Pressing right when the caret is immediately left of some entity (pill, emojione emoji, etc..) causes the caret to jump to the left of the next entity (or end of the message if there are no more entities)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

(cherry picked from commit 0982617)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2018-07-03 23:36:59 +01:00
parent c6837af398
commit 372fa29ad3
No known key found for this signature in database
GPG Key ID: 3F879DA5AD802A5E

View File

@ -449,13 +449,13 @@ export default class MessageComposerInput extends React.Component {
if (this.direction !== '') {
const focusedNode = editorState.focusInline || editorState.focusText;
if (focusedNode.isVoid) {
const edge = this.direction === 'Previous' ? 'End' : 'Start';
if (editorState.isCollapsed) {
change = change[`collapseToEndOf${ this.direction }Text`]();
}
else {
change = change[`collapseTo${ edge }Of${ this.direction }Text`]();
} else {
const block = this.direction === 'Previous' ? editorState.previousText : editorState.nextText;
if (block) {
change = change.moveFocusToEndOf(block)
change = change[`moveFocusTo${ edge }Of`](block);
}
}
editorState = change.value;