mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Don't cancel caption edit by outside click.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user