fix bug where selection breaks after inserting emoji
This commit is contained in:
parent
11cea61661
commit
cace5e8bfc
1 changed files with 9 additions and 1 deletions
|
@ -33,7 +33,6 @@ import PlainWithPillsSerializer from "../../../autocomplete/PlainWithPillsSerial
|
|||
// Entity} from 'draft-js';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import escape from 'lodash/escape';
|
||||
import Promise from 'bluebird';
|
||||
|
||||
import MatrixClientPeg from '../../../MatrixClientPeg';
|
||||
|
@ -507,6 +506,15 @@ export default class MessageComposerInput extends React.Component {
|
|||
}
|
||||
});
|
||||
|
||||
// work around weird bug where inserting emoji via the macOS
|
||||
// emoji picker can leave the selection stuck in the emoji's
|
||||
// child text. This seems to happen due to selection getting
|
||||
// moved in the normalisation phase after calculating these changes
|
||||
if (editorState.document.getParent(editorState.anchorKey).type === 'emoji') {
|
||||
change = change.collapseToStartOfNextText();
|
||||
editorState = change.value;
|
||||
}
|
||||
|
||||
/*
|
||||
const currentBlock = editorState.getSelection().getStartKey();
|
||||
const currentSelection = editorState.getSelection();
|
||||
|
|
Loading…
Reference in a new issue