diff --git a/Telegram/Resources/export_html/css/style.css b/Telegram/Resources/export_html/css/style.css index 8493418e7..456d59f46 100644 --- a/Telegram/Resources/export_html/css/style.css +++ b/Telegram/Resources/export_html/css/style.css @@ -531,3 +531,16 @@ div.toast_shown { 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; +} diff --git a/Telegram/Resources/export_html/js/script.js b/Telegram/Resources/export_html/js/script.js index f206440a0..23b4009e5 100644 --- a/Telegram/Resources/export_html/js/script.js +++ b/Telegram/Resources/export_html/js/script.js @@ -52,6 +52,12 @@ function ShowMentionName() { return false; } +function ShowSpoiler(target) { + if (target.classList.contains("hidden")) { + target.classList.toggle("hidden"); + } +} + function AddClass(element, name) { var current = element.className; var expression = new RegExp('(^|\\s)' + name + '(\\s|$)', 'g'); diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp b/Telegram/SourceFiles/export/data/export_data_types.cpp index ce69f37bd..4a0a9b361 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.cpp +++ b/Telegram/SourceFiles/export/data/export_data_types.cpp @@ -154,7 +154,7 @@ std::vector ParseText( [](const MTPDmessageEntityBlockquote&) { return Type::Blockquote; }, [](const MTPDmessageEntityBankCard&) { return Type::BankCard; }, - [](const MTPDmessageEntitySpoiler&) { return Type::Unknown; }); // #TODO spoiler + [](const MTPDmessageEntitySpoiler&) { return Type::Spoiler; }); part.text = mid(start, length); part.additional = entity.match( [](const MTPDmessageEntityPre &data) { diff --git a/Telegram/SourceFiles/export/data/export_data_types.h b/Telegram/SourceFiles/export/data/export_data_types.h index 495446814..c0871f2a8 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.h +++ b/Telegram/SourceFiles/export/data/export_data_types.h @@ -541,6 +541,7 @@ struct TextPart { Strike, Blockquote, BankCard, + Spoiler, }; Type type = Type::Text; Utf8String text; diff --git a/Telegram/SourceFiles/export/output/export_output_html.cpp b/Telegram/SourceFiles/export/output/export_output_html.cpp index d60313310..2f400be01 100644 --- a/Telegram/SourceFiles/export/output/export_output_html.cpp +++ b/Telegram/SourceFiles/export/output/export_output_html.cpp @@ -270,6 +270,10 @@ QByteArray FormatText( return "
" + text + "
"; case Type::BankCard: return text; + case Type::Spoiler: return "" + "" + + text + ""; } Unexpected("Type in text entities serialization."); }) | ranges::to_vector); diff --git a/Telegram/SourceFiles/export/output/export_output_json.cpp b/Telegram/SourceFiles/export/output/export_output_json.cpp index 907dbeafc..b0240b9b0 100644 --- a/Telegram/SourceFiles/export/output/export_output_json.cpp +++ b/Telegram/SourceFiles/export/output/export_output_json.cpp @@ -176,6 +176,7 @@ QByteArray SerializeText( case Type::Strike: return "strikethrough"; case Type::Blockquote: return "blockquote"; case Type::BankCard: return "bank_card"; + case Type::Spoiler: return "spoiler"; } Unexpected("Type in SerializeText."); }();