mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Don't cancel caption edit by outside click.
This commit is contained in:
parent
75a1db9900
commit
9c91b03a5b
2 changed files with 15 additions and 1 deletions
|
@ -67,6 +67,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr auto kChangesDebounceTimeout = crl::time(1000);
|
||||
|
||||
auto ListFromMimeData(not_null<const QMimeData*> data, bool premium) {
|
||||
using Error = Ui::PreparedList::Error;
|
||||
const auto list = Core::ReadMimeUrls(data);
|
||||
|
@ -288,12 +290,23 @@ void EditCaptionBox::setupField() {
|
|||
}
|
||||
|
||||
void EditCaptionBox::setInitialText() {
|
||||
const auto initial = PrepareEditText(_historyItem);
|
||||
_field->setTextWithTags(
|
||||
PrepareEditText(_historyItem),
|
||||
initial,
|
||||
Ui::InputField::HistoryAction::Clear);
|
||||
auto cursor = _field->textCursor();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
_field->setTextCursor(cursor);
|
||||
|
||||
_checkChangedTimer.setCallback([=] {
|
||||
if (_field->getTextWithAppliedMarkdown() == initial) {
|
||||
setCloseByOutsideClick(true);
|
||||
}
|
||||
});
|
||||
connect(_field, &Ui::InputField::changed, [=] {
|
||||
_checkChangedTimer.callOnce(kChangesDebounceTimeout);
|
||||
setCloseByOutsideClick(false);
|
||||
});
|
||||
}
|
||||
|
||||
void EditCaptionBox::setupControls() {
|
||||
|
|
|
@ -95,6 +95,7 @@ private:
|
|||
|
||||
mtpRequestId _saveRequestId = 0;
|
||||
|
||||
base::Timer _checkChangedTimer;
|
||||
bool _isPhoto = false;
|
||||
bool _asFile = false;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue