Add PlainLink(TextWithEntities) and SingleCustomEmoji.
This commit is contained in:
parent
c3616927eb
commit
4539d0bab4
2 changed files with 14 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue