2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +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

@@ -48,6 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_document.h"
#include "data/data_user.h"
#include "data/data_premium_limits.h"
#include "data/stickers/data_custom_emoji.h"
#include "media/clip/media_clip_reader.h"
#include "api/api_common.h"
#include "window/window_session_controller.h"
@@ -715,13 +716,15 @@ void SendFilesBox::setupEmojiPanel() {
Expects(_caption != nullptr);
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,
@@ -731,6 +734,10 @@ void SendFilesBox::setupEmojiPanel() {
) | rpl::start_with_next([=](EmojiPtr emoji) {
Ui::InsertEmojiAtCursor(_caption->textCursor(), emoji);
}, lifetime());
_emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](Selector::FileChosen data) {
Data::InsertCustomEmoji(_caption.data(), data.document);
}, lifetime());
const auto filterCallback = [=](not_null<QEvent*> event) {
emojiFilterForGeometry(event);