diff --git a/ui/text/text_utilities.cpp b/ui/text/text_utilities.cpp index 59dfef0..c2c5114 100644 --- a/ui/text/text_utilities.cpp +++ b/ui/text/text_utilities.cpp @@ -58,6 +58,10 @@ TextWithEntities PlainLink(const QString &text) { return WithSingleEntity(text, EntityType::PlainLink); } +TextWithEntities PlainLink(TextWithEntities text) { + return Wrapped(std::move(text), EntityType::PlainLink, QString()); +} + TextWithEntities Wrapped( TextWithEntities text, EntityType type, @@ -100,6 +104,13 @@ TextWithEntities RichLangValue(const QString &text) { return result; } +TextWithEntities SingleCustomEmoji(QString data) { + return { + u"@"_q, + { EntityInText(EntityType::CustomEmoji, 0, 1, data) }, + }; +} + TextWithEntities Mid(const TextWithEntities &text, int position, int n) { if (n == -1) { n = int(text.text.size()) - position; diff --git a/ui/text/text_utilities.h b/ui/text/text_utilities.h index 61721ef..e493cec 100644 --- a/ui/text/text_utilities.h +++ b/ui/text/text_utilities.h @@ -36,6 +36,7 @@ inline constexpr auto Upper = details::ToUpperType{}; const QString &url = u"internal:action"_q); [[nodiscard]] TextWithEntities Link(TextWithEntities text, int index); [[nodiscard]] TextWithEntities PlainLink(const QString &text); +[[nodiscard]] TextWithEntities PlainLink(TextWithEntities text); [[nodiscard]] TextWithEntities Wrapped( TextWithEntities text, EntityType type, @@ -45,6 +46,8 @@ inline constexpr auto Upper = details::ToUpperType{}; return { text }; } +[[nodiscard]] TextWithEntities SingleCustomEmoji(QString data); + [[nodiscard]] inline auto ToUpper() { return rpl::map(Upper); }