2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 00:46:08 +00:00

Fix custom emoji in edit caption / send files box.

This commit is contained in:
John Preston
2022-07-25 13:34:18 +03:00
parent 075ced2742
commit 2d6008f6ca
17 changed files with 83 additions and 40 deletions

View File

@@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "data/data_user.h"
#include "data/data_premium_limits.h"
#include "data/stickers/data_custom_emoji.h"
#include "editor/photo_editor_layer_widget.h"
#include "history/history_drag_area.h"
#include "history/history_item.h"
@@ -473,13 +474,15 @@ void EditCaptionBox::setupDragArea() {
void EditCaptionBox::setupEmojiPanel() {
const auto container = getDelegate()->outerContainer();
using Selector = ChatHelpers::TabbedSelector;
_emojiPanel = base::make_unique_q<ChatHelpers::TabbedPanel>(
container,
_controller,
object_ptr<ChatHelpers::TabbedSelector>(
object_ptr<Selector>(
nullptr,
_controller,
ChatHelpers::TabbedSelector::Mode::EmojiOnly));
Window::GifPauseReason::Layer,
Selector::Mode::EmojiOnly));
_emojiPanel->setDesiredHeightValues(
1.,
st::emojiPanMinHeight / 2,
@@ -489,6 +492,10 @@ void EditCaptionBox::setupEmojiPanel() {
) | rpl::start_with_next([=](EmojiPtr emoji) {
Ui::InsertEmojiAtCursor(_field->textCursor(), emoji);
}, lifetime());
_emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](Selector::FileChosen data) {
Data::InsertCustomEmoji(_field.get(), data.document);
}, lifetime());
const auto filterCallback = [=](not_null<QEvent*> event) {
emojiFilterForGeometry(event);