mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-01 23:25:15 +00:00
Fixed caption area height in EditCaptionBox.
Regression was introduced in 51f960442e
.
This commit is contained in:
@@ -660,6 +660,7 @@ void EditCaptionBox::updateEditPreview() {
|
||||
}
|
||||
}
|
||||
updateEditMediaButton();
|
||||
updateCaptionMaxHeight();
|
||||
captionResized();
|
||||
}
|
||||
|
||||
@@ -783,6 +784,7 @@ void EditCaptionBox::prepare() {
|
||||
auto cursor = _field->textCursor();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
_field->setTextCursor(cursor);
|
||||
updateCaptionMaxHeight();
|
||||
|
||||
setupDragArea();
|
||||
}
|
||||
@@ -826,6 +828,28 @@ void EditCaptionBox::captionResized() {
|
||||
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() {
|
||||
const auto container = getDelegate()->outerContainer();
|
||||
_emojiPanel = base::make_unique_q<ChatHelpers::TabbedPanel>(
|
||||
|
Reference in New Issue
Block a user