Merge branch 'emoji-backspace' into 'main'
Disable EmojiNode for now Closes #1525 See merge request soapbox-pub/soapbox!2755
This commit is contained in:
commit
72065ffe23
|
@ -29,7 +29,7 @@ class EmojiNode extends DecoratorNode<JSX.Element> {
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone(node: EmojiNode): EmojiNode {
|
static clone(node: EmojiNode): EmojiNode {
|
||||||
return new EmojiNode(node.__name, node.__src);
|
return new EmojiNode(node.__name, node.__src, node.__key);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(name: string, src: string, key?: NodeKey) {
|
constructor(name: string, src: string, key?: NodeKey) {
|
||||||
|
@ -79,7 +79,7 @@ class EmojiNode extends DecoratorNode<JSX.Element> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
isTextEntity(): true {
|
isTextEntity(): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ import { selectAccount } from 'soapbox/selectors';
|
||||||
import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions';
|
import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions';
|
||||||
|
|
||||||
import AutosuggestAccount from '../../components/autosuggest-account';
|
import AutosuggestAccount from '../../components/autosuggest-account';
|
||||||
import { $createEmojiNode } from '../nodes/emoji-node';
|
|
||||||
|
|
||||||
import type { AutoSuggestion } from 'soapbox/components/autosuggest-input';
|
import type { AutoSuggestion } from 'soapbox/components/autosuggest-input';
|
||||||
|
|
||||||
|
@ -315,16 +314,7 @@ const AutosuggestPlugin = ({
|
||||||
if (isNativeEmoji(suggestion)) {
|
if (isNativeEmoji(suggestion)) {
|
||||||
node.spliceText(leadOffset - 1, matchingString.length, `${suggestion.native} `, true);
|
node.spliceText(leadOffset - 1, matchingString.length, `${suggestion.native} `, true);
|
||||||
} else {
|
} else {
|
||||||
const completion = suggestion.colons;
|
node.spliceText(leadOffset - 1, matchingString.length, `${suggestion.colons} `, true);
|
||||||
|
|
||||||
let emojiText;
|
|
||||||
|
|
||||||
if (leadOffset === 1) emojiText = node;
|
|
||||||
else [, emojiText] = node.splitText(leadOffset - 1);
|
|
||||||
|
|
||||||
[emojiText] = emojiText.splitText(matchingString.length);
|
|
||||||
|
|
||||||
emojiText?.replace($createEmojiNode(completion, suggestion.imageUrl));
|
|
||||||
}
|
}
|
||||||
} else if (suggestion[0] === '#') {
|
} else if (suggestion[0] === '#') {
|
||||||
node.setTextContent(`${suggestion} `);
|
node.setTextContent(`${suggestion} `);
|
||||||
|
|
Loading…
Reference in New Issue