lexical: render native emojis as Twemoji
This commit is contained in:
@ -33,9 +33,8 @@ import React, {
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
import { clearComposeSuggestions, fetchComposeSuggestions } from 'soapbox/actions/compose';
|
||||
import { useEmoji } from 'soapbox/actions/emojis';
|
||||
import { useEmoji as chooseEmoji } from 'soapbox/actions/emojis';
|
||||
import AutosuggestEmoji from 'soapbox/components/autosuggest-emoji';
|
||||
import { isNativeEmoji } from 'soapbox/features/emoji';
|
||||
import { useAppDispatch, useCompose } from 'soapbox/hooks';
|
||||
import { selectAccount } from 'soapbox/selectors';
|
||||
import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions';
|
||||
@ -322,13 +321,8 @@ const AutosuggestPlugin = ({
|
||||
|
||||
if (typeof suggestion === 'object') {
|
||||
if (!suggestion.id) return;
|
||||
dispatch(useEmoji(suggestion)); // eslint-disable-line react-hooks/rules-of-hooks
|
||||
|
||||
if (isNativeEmoji(suggestion)) {
|
||||
node.spliceText(offset, matchingString.length, `${suggestion.native} `, true);
|
||||
} else {
|
||||
replaceMatch($createEmojiNode(suggestion.colons, suggestion.imageUrl));
|
||||
}
|
||||
dispatch(chooseEmoji(suggestion));
|
||||
replaceMatch($createEmojiNode(suggestion));
|
||||
} else if (suggestion[0] === '#') {
|
||||
node.setTextContent(`${suggestion} `);
|
||||
node.select();
|
||||
|
||||
Reference in New Issue
Block a user