2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +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

@@ -1168,16 +1168,24 @@ void InputField::onTouchTimer() {
_touchRightButton = true;
}
void InputField::enableMarkdownSupport(bool enabled) {
_markdownEnabled = enabled;
}
void InputField::setInstantReplaces(const InstantReplaces &replaces) {
_mutableInstantReplaces = replaces;
}
void InputField::enableInstantReplaces(bool enabled) {
_instantReplacesEnabled = enabled;
void InputField::setInstantReplacesEnabled(rpl::producer<bool> enabled) {
std::move(
enabled
) | rpl::start_with_next([=](bool value) {
_instantReplacesEnabled = value;
}, lifetime());
}
void InputField::setMarkdownReplacesEnabled(rpl::producer<bool> enabled) {
std::move(
enabled
) | rpl::start_with_next([=](bool value) {
_markdownEnabled = value;
}, lifetime());
}
void InputField::setTagMimeProcessor(

View File

@@ -187,7 +187,8 @@ public:
void setAdditionalMargin(int margin);
void setInstantReplaces(const InstantReplaces &replaces);
void enableInstantReplaces(bool enabled);
void setInstantReplacesEnabled(rpl::producer<bool> enabled);
void setMarkdownReplacesEnabled(rpl::producer<bool> enabled);
void commitInstantReplacement(
int from,
int till,
@@ -229,8 +230,8 @@ public:
Both,
};
void setSubmitSettings(SubmitSettings settings);
void enableMarkdownSupport(bool enabled = true);
void customUpDown(bool isCustom);
void customTab(bool isCustom);
not_null<QTextDocument*> document();
not_null<const QTextDocument*> document() const;
@@ -381,6 +382,7 @@ private:
int _additionalMargin = 0;
bool _customUpDown = false;
bool _customTab = false;
QString _placeholder;
base::lambda<QString()> _placeholderFactory;