Allow copy custom emoji from panel.

This commit is contained in:
John Preston 2024-05-19 11:57:10 +04:00
parent cedd8fc546
commit 74db2167f9

View file

@ -1134,9 +1134,7 @@ void EmojiListWidget::fillRecentMenu(
not_null<Ui::PopupMenu*> menu, not_null<Ui::PopupMenu*> menu,
int section, int section,
int index) { int index) {
if (section != int(Section::Recent)) { const auto recent = (section == int(Section::Recent));
return;
}
const auto addAction = Ui::Menu::CreateAddActionCallback(menu); const auto addAction = Ui::Menu::CreateAddActionCallback(menu);
const auto over = OverEmoji{ section, index }; const auto over = OverEmoji{ section, index };
const auto emoji = lookupOverEmoji(&over); const auto emoji = lookupOverEmoji(&over);
@ -1157,18 +1155,21 @@ void EmojiListWidget::fillRecentMenu(
TextUtilities::SetClipboardText(data); TextUtilities::SetClipboardText(data);
}, &st::menuIconCopy); }, &st::menuIconCopy);
} }
if (setId && _features.openStickerSets) { if (recent && setId && _features.openStickerSets) {
addAction( addAction(
tr::lng_emoji_view_pack(tr::now), tr::lng_emoji_view_pack(tr::now),
crl::guard(this, [=] { displaySet(setId); }), crl::guard(this, [=] { displaySet(setId); }),
&st::menuIconShowAll); &st::menuIconShowAll);
} }
} else if (emoji) { } else if (recent && emoji) {
addAction(tr::lng_emoji_copy(tr::now), [=] { addAction(tr::lng_emoji_copy(tr::now), [=] {
const auto text = emoji->text(); const auto text = emoji->text();
TextUtilities::SetClipboardText({ text, { text } }); TextUtilities::SetClipboardText({ text, { text } });
}, &st::menuIconCopy); }, &st::menuIconCopy);
} }
if (!recent) {
return;
}
auto id = RecentEmojiId{ emoji }; auto id = RecentEmojiId{ emoji };
if (custom) { if (custom) {
id.data = RecentEmojiDocument{ id.data = RecentEmojiDocument{