2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Support markdown and replaces in media captions.

This commit is contained in:
John Preston
2018-05-24 16:03:21 +03:00
parent 6f6ec217e3
commit 5e7642b42a
22 changed files with 133 additions and 63 deletions

View File

@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/storage_media_prepare.h"
#include "mainwidget.h"
#include "history/history_media_types.h"
#include "chat_helpers/message_field.h"
#include "core/file_utilities.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
@@ -1578,6 +1579,8 @@ void SendFilesBox::setupCaption() {
Unexpected("action in MimeData hook.");
});
_caption->setInstantReplaces(Ui::InstantReplaces::Default());
_caption->setInstantReplacesEnabled(Global::ReplaceEmojiValue());
_caption->setMarkdownReplacesEnabled(Global::ReplaceEmojiValue());
}
void SendFilesBox::captionResized() {
@@ -1789,10 +1792,8 @@ void SendFilesBox::send(bool ctrlShiftEnter) {
_confirmed = true;
if (_confirmedCallback) {
auto caption = _caption
? TextUtilities::PrepareForSending(
_caption->getLastText(),
TextUtilities::PrepareTextOption::CheckLinks)
: QString();
? _caption->getTextWithTags()
: TextWithTags();
_confirmedCallback(
std::move(_list),
way,