Merge branch 'develop' into travis/permalink-routing
commit
d58ff90ec1
|
@ -573,9 +573,14 @@ export default class MessageComposerInput extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
// emojioneify any emoji
|
// emojioneify any emoji
|
||||||
editorState.document.getTexts().forEach(node => {
|
let foundEmoji;
|
||||||
|
do {
|
||||||
|
foundEmoji = false;
|
||||||
|
|
||||||
|
for (const node of editorState.document.getTexts()) {
|
||||||
if (node.text !== '' && HtmlUtils.containsEmoji(node.text)) {
|
if (node.text !== '' && HtmlUtils.containsEmoji(node.text)) {
|
||||||
let match;
|
let match;
|
||||||
|
EMOJI_REGEX.lastIndex = 0;
|
||||||
while ((match = EMOJI_REGEX.exec(node.text)) !== null) {
|
while ((match = EMOJI_REGEX.exec(node.text)) !== null) {
|
||||||
const range = Range.create({
|
const range = Range.create({
|
||||||
anchor: {
|
anchor: {
|
||||||
|
@ -593,9 +598,17 @@ export default class MessageComposerInput extends React.Component {
|
||||||
});
|
});
|
||||||
change = change.insertInlineAtRange(range, inline);
|
change = change.insertInlineAtRange(range, inline);
|
||||||
editorState = change.value;
|
editorState = change.value;
|
||||||
|
|
||||||
|
// if we replaced an emoji, start again looking for more
|
||||||
|
// emoji in the new editor state since doing the replacement
|
||||||
|
// will change the node structure & offsets so we can't compute
|
||||||
|
// insertion ranges from node.key / match.index anymore.
|
||||||
|
foundEmoji = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
} while (foundEmoji);
|
||||||
|
|
||||||
// work around weird bug where inserting emoji via the macOS
|
// work around weird bug where inserting emoji via the macOS
|
||||||
// emoji picker can leave the selection stuck in the emoji's
|
// emoji picker can leave the selection stuck in the emoji's
|
||||||
|
|
Loading…
Reference in New Issue