Fix custom emoji in initial send files caption.

This commit is contained in:
John Preston 2022-08-15 19:10:38 +03:00
parent 888306c017
commit 7c2d3a8855
2 changed files with 12 additions and 6 deletions

View file

@ -260,12 +260,8 @@ SendFilesBox::SendFilesBox(
, _sendLimit(peer->slowmodeApplied() ? SendLimit::One : SendLimit::Many) , _sendLimit(peer->slowmodeApplied() ? SendLimit::One : SendLimit::Many)
, _sendMenuType(sendMenuType) , _sendMenuType(sendMenuType)
, _allowEmojiWithoutPremium(Data::AllowEmojiWithoutPremium(peer)) , _allowEmojiWithoutPremium(Data::AllowEmojiWithoutPremium(peer))
, _caption( , _caption(this, st::confirmCaptionArea, Ui::InputField::Mode::MultiLine)
this, , _prefilledCaptionText(std::move(caption))
st::confirmCaptionArea,
Ui::InputField::Mode::MultiLine,
nullptr,
caption)
, _scroll(this, st::boxScroll) , _scroll(this, st::boxScroll)
, _inner( , _inner(
_scroll->setOwnedWidget( _scroll->setOwnedWidget(
@ -688,6 +684,15 @@ void SendFilesBox::setupCaption() {
&_controller->session(), &_controller->session(),
{ .suggestCustomEmoji = true, .allowCustomWithoutPremium = allow }); { .suggestCustomEmoji = true, .allowCustomWithoutPremium = allow });
if (!_prefilledCaptionText.text.isEmpty()) {
_caption->setTextWithTags(
_prefilledCaptionText,
Ui::InputField::HistoryAction::Clear);
auto cursor = _caption->textCursor();
cursor.movePosition(QTextCursor::End);
_caption->setTextCursor(cursor);
}
_caption->setSubmitSettings( _caption->setSubmitSettings(
Core::App().settings().sendSubmitWay()); Core::App().settings().sendSubmitWay());
_caption->setMaxLength(kMaxMessageLength); _caption->setMaxLength(kMaxMessageLength);

View file

@ -180,6 +180,7 @@ private:
bool _confirmed = false; bool _confirmed = false;
object_ptr<Ui::InputField> _caption = { nullptr }; object_ptr<Ui::InputField> _caption = { nullptr };
TextWithTags _prefilledCaptionText;
object_ptr<Ui::EmojiButton> _emojiToggle = { nullptr }; object_ptr<Ui::EmojiButton> _emojiToggle = { nullptr };
base::unique_qptr<ChatHelpers::TabbedPanel> _emojiPanel; base::unique_qptr<ChatHelpers::TabbedPanel> _emojiPanel;
base::unique_qptr<QObject> _emojiFilter; base::unique_qptr<QObject> _emojiFilter;