mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added spoiler support to export.
This commit is contained in:
parent
1cca4d71bd
commit
4252066cf6
6 changed files with 26 additions and 1 deletions
|
@ -531,3 +531,16 @@ div.toast_shown {
|
||||||
background-image: url(../images/media_video@2x.png)
|
background-image: url(../images/media_video@2x.png)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spoiler {
|
||||||
|
background: #e8e8e8;
|
||||||
|
}
|
||||||
|
.spoiler.hidden {
|
||||||
|
background: #a9a9a9;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
.spoiler.hidden span {
|
||||||
|
opacity: 0;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
|
@ -52,6 +52,12 @@ function ShowMentionName() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ShowSpoiler(target) {
|
||||||
|
if (target.classList.contains("hidden")) {
|
||||||
|
target.classList.toggle("hidden");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function AddClass(element, name) {
|
function AddClass(element, name) {
|
||||||
var current = element.className;
|
var current = element.className;
|
||||||
var expression = new RegExp('(^|\\s)' + name + '(\\s|$)', 'g');
|
var expression = new RegExp('(^|\\s)' + name + '(\\s|$)', 'g');
|
||||||
|
|
|
@ -154,7 +154,7 @@ std::vector<TextPart> ParseText(
|
||||||
[](const MTPDmessageEntityBlockquote&) {
|
[](const MTPDmessageEntityBlockquote&) {
|
||||||
return Type::Blockquote; },
|
return Type::Blockquote; },
|
||||||
[](const MTPDmessageEntityBankCard&) { return Type::BankCard; },
|
[](const MTPDmessageEntityBankCard&) { return Type::BankCard; },
|
||||||
[](const MTPDmessageEntitySpoiler&) { return Type::Unknown; }); // #TODO spoiler
|
[](const MTPDmessageEntitySpoiler&) { return Type::Spoiler; });
|
||||||
part.text = mid(start, length);
|
part.text = mid(start, length);
|
||||||
part.additional = entity.match(
|
part.additional = entity.match(
|
||||||
[](const MTPDmessageEntityPre &data) {
|
[](const MTPDmessageEntityPre &data) {
|
||||||
|
|
|
@ -541,6 +541,7 @@ struct TextPart {
|
||||||
Strike,
|
Strike,
|
||||||
Blockquote,
|
Blockquote,
|
||||||
BankCard,
|
BankCard,
|
||||||
|
Spoiler,
|
||||||
};
|
};
|
||||||
Type type = Type::Text;
|
Type type = Type::Text;
|
||||||
Utf8String text;
|
Utf8String text;
|
||||||
|
|
|
@ -270,6 +270,10 @@ QByteArray FormatText(
|
||||||
return "<blockquote>" + text + "</blockquote>";
|
return "<blockquote>" + text + "</blockquote>";
|
||||||
case Type::BankCard:
|
case Type::BankCard:
|
||||||
return text;
|
return text;
|
||||||
|
case Type::Spoiler: return "<span class=\"spoiler hidden\" "
|
||||||
|
"onclick=\"ShowSpoiler(this)\">"
|
||||||
|
"<span aria-hidden=\"true\">"
|
||||||
|
+ text + "</span></span>";
|
||||||
}
|
}
|
||||||
Unexpected("Type in text entities serialization.");
|
Unexpected("Type in text entities serialization.");
|
||||||
}) | ranges::to_vector);
|
}) | ranges::to_vector);
|
||||||
|
|
|
@ -176,6 +176,7 @@ QByteArray SerializeText(
|
||||||
case Type::Strike: return "strikethrough";
|
case Type::Strike: return "strikethrough";
|
||||||
case Type::Blockquote: return "blockquote";
|
case Type::Blockquote: return "blockquote";
|
||||||
case Type::BankCard: return "bank_card";
|
case Type::BankCard: return "bank_card";
|
||||||
|
case Type::Spoiler: return "spoiler";
|
||||||
}
|
}
|
||||||
Unexpected("Type in SerializeText.");
|
Unexpected("Type in SerializeText.");
|
||||||
}();
|
}();
|
||||||
|
|
Loading…
Add table
Reference in a new issue