You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-20 16:22:28 +03:00
fix bug where selection breaks after inserting emoji
This commit is contained in:
@@ -33,7 +33,6 @@ import PlainWithPillsSerializer from "../../../autocomplete/PlainWithPillsSerial
|
|||||||
// Entity} from 'draft-js';
|
// Entity} from 'draft-js';
|
||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import escape from 'lodash/escape';
|
|
||||||
import Promise from 'bluebird';
|
import Promise from 'bluebird';
|
||||||
|
|
||||||
import MatrixClientPeg from '../../../MatrixClientPeg';
|
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 currentBlock = editorState.getSelection().getStartKey();
|
||||||
const currentSelection = editorState.getSelection();
|
const currentSelection = editorState.getSelection();
|
||||||
|
|||||||
Reference in New Issue
Block a user