mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed caption area height in EditCaptionBox.
Regression was introduced in 51f960442e
.
This commit is contained in:
parent
22213a71c1
commit
5bd17ae1b2
3 changed files with 26 additions and 0 deletions
|
@ -382,6 +382,7 @@ confirmCaptionArea: InputField(defaultInputField) {
|
||||||
textMargins: margins(1px, 26px, 31px, 4px);
|
textMargins: margins(1px, 26px, 31px, 4px);
|
||||||
heightMax: 158px;
|
heightMax: 158px;
|
||||||
}
|
}
|
||||||
|
confirmEditCaptionAreaHeightMax: 78px;
|
||||||
confirmBg: windowBgOver;
|
confirmBg: windowBgOver;
|
||||||
confirmMaxHeight: 245px;
|
confirmMaxHeight: 245px;
|
||||||
confirmMaxHeightSkip: 25px;
|
confirmMaxHeightSkip: 25px;
|
||||||
|
|
|
@ -660,6 +660,7 @@ void EditCaptionBox::updateEditPreview() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateEditMediaButton();
|
updateEditMediaButton();
|
||||||
|
updateCaptionMaxHeight();
|
||||||
captionResized();
|
captionResized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,6 +784,7 @@ void EditCaptionBox::prepare() {
|
||||||
auto cursor = _field->textCursor();
|
auto cursor = _field->textCursor();
|
||||||
cursor.movePosition(QTextCursor::End);
|
cursor.movePosition(QTextCursor::End);
|
||||||
_field->setTextCursor(cursor);
|
_field->setTextCursor(cursor);
|
||||||
|
updateCaptionMaxHeight();
|
||||||
|
|
||||||
setupDragArea();
|
setupDragArea();
|
||||||
}
|
}
|
||||||
|
@ -826,6 +828,28 @@ void EditCaptionBox::captionResized() {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditCaptionBox::updateCaptionMaxHeight() {
|
||||||
|
// Save.
|
||||||
|
const auto wasCursor = _field->textCursor();
|
||||||
|
const auto position = wasCursor.position();
|
||||||
|
const auto anchor = wasCursor.anchor();
|
||||||
|
const auto text = _field->getTextWithAppliedMarkdown();
|
||||||
|
_field->setTextWithTags({});
|
||||||
|
|
||||||
|
_field->setMaxHeight(_doc
|
||||||
|
? st::confirmCaptionArea.heightMax
|
||||||
|
: st::confirmEditCaptionAreaHeightMax);
|
||||||
|
|
||||||
|
// Restore.
|
||||||
|
_field->setTextWithTags(text);
|
||||||
|
auto cursor = _field->textCursor();
|
||||||
|
cursor.setPosition(anchor);
|
||||||
|
if (position != anchor) {
|
||||||
|
cursor.setPosition(position, QTextCursor::KeepAnchor);
|
||||||
|
}
|
||||||
|
_field->setTextCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
void EditCaptionBox::setupEmojiPanel() {
|
void EditCaptionBox::setupEmojiPanel() {
|
||||||
const auto container = getDelegate()->outerContainer();
|
const auto container = getDelegate()->outerContainer();
|
||||||
_emojiPanel = base::make_unique_q<ChatHelpers::TabbedPanel>(
|
_emojiPanel = base::make_unique_q<ChatHelpers::TabbedPanel>(
|
||||||
|
|
|
@ -91,6 +91,7 @@ private:
|
||||||
bool fileFromClipboard(not_null<const QMimeData*> data);
|
bool fileFromClipboard(not_null<const QMimeData*> data);
|
||||||
void updateEditPreview();
|
void updateEditPreview();
|
||||||
void updateEditMediaButton();
|
void updateEditMediaButton();
|
||||||
|
void updateCaptionMaxHeight();
|
||||||
|
|
||||||
int errorTopSkip() const;
|
int errorTopSkip() const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue