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>pull/21833/head
parent
c6837af398
commit
372fa29ad3
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue