2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-04 08:25:38 +00:00

Unite InputField and InputArea.

Also support and use instant replaces in InputField-s.
This commit is contained in:
John Preston
2018-05-20 20:42:30 +03:00
parent 8e442563f2
commit 30dd8fe070
22 changed files with 771 additions and 1271 deletions

View File

@@ -130,9 +130,15 @@ EditCaptionBox::EditCaptionBox(
}
Assert(_animated || _photo || _doc);
_field.create(this, st::confirmCaptionArea, langFactory(lng_photo_caption), caption);
_field.create(
this,
st::confirmCaptionArea,
Ui::InputField::Mode::MultiLine,
langFactory(lng_photo_caption),
caption);
_field->setMaxLength(MaxPhotoCaption);
_field->setCtrlEnterSubmit(Ui::CtrlEnterSubmit::Both);
_field->setInstantReplaces(Ui::InstantReplaces::Default());
}
void EditCaptionBox::prepareGifPreview(DocumentData *document) {
@@ -177,11 +183,11 @@ void EditCaptionBox::prepare() {
addButton(langFactory(lng_cancel), [this] { closeBox(); });
updateBoxSize();
connect(_field, &Ui::InputArea::submitted, this, [this] { save(); });
connect(_field, &Ui::InputArea::cancelled, this, [this] {
connect(_field, &Ui::InputField::submitted, this, [this] { save(); });
connect(_field, &Ui::InputField::cancelled, this, [this] {
closeBox();
});
connect(_field, &Ui::InputArea::resized, this, [this] {
connect(_field, &Ui::InputField::resized, this, [this] {
captionResized();
});