Always make custom emoji most-inner tag.

This commit is contained in:
John Preston 2023-10-31 12:47:48 +04:00
parent 835ba51f5e
commit d7f12b083e

View file

@ -2111,14 +2111,11 @@ EntitiesInText ConvertTextTagsToEntities(const TextWithTags::Tags &tags) {
closeType(type);
}
}
if (linkChanged && !nextState.link.isEmpty()) {
if (Ui::InputField::IsCustomEmojiLink(nextState.link)) {
const auto data = Ui::InputField::CustomEmojiEntityData(
nextState.link);
if (!data.isEmpty()) {
openType(EntityType::CustomEmoji, data);
}
} else if (IsMentionLink(nextState.link)) {
const auto openLink = linkChanged && !nextState.link.isEmpty();
const auto openCustomEmoji = openLink
&& Ui::InputField::IsCustomEmojiLink(nextState.link);
if (openLink && !openCustomEmoji) {
if (IsMentionLink(nextState.link)) {
const auto data = MentionEntityData(nextState.link);
if (!data.isEmpty()) {
openType(EntityType::MentionName, data);
@ -2132,6 +2129,13 @@ EntitiesInText ConvertTextTagsToEntities(const TextWithTags::Tags &tags) {
openType(type, nextState.language);
}
}
if (openCustomEmoji) {
const auto data = Ui::InputField::CustomEmojiEntityData(
nextState.link);
if (!data.isEmpty()) {
openType(EntityType::CustomEmoji, data);
}
}
state = nextState;
};
const auto stateForTag = [&](const QString &tag) {