mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-03 18:17:59 +01:00
Sticker Tooltip: Clean input; Emoji Tooltip: Save to recent (#1305)
This commit is contained in:
parent
bedd7727cd
commit
bf6c6ef035
@ -538,7 +538,7 @@ const Composer: FC<OwnProps & StateProps & DispatchProps> = ({
|
||||
resetComposer, stopRecordingVoice, showDialog, slowMode, isAdmin, sendMessage, forwardMessages, lang,
|
||||
]);
|
||||
|
||||
const handleStickerSelect = useCallback((sticker: ApiSticker) => {
|
||||
const handleStickerSelect = useCallback((sticker: ApiSticker, shouldPreserveInput = false) => {
|
||||
sticker = {
|
||||
...sticker,
|
||||
isPreloadedGlobally: true,
|
||||
@ -549,7 +549,7 @@ const Composer: FC<OwnProps & StateProps & DispatchProps> = ({
|
||||
openCalendar();
|
||||
} else {
|
||||
sendMessage({ sticker });
|
||||
requestAnimationFrame(() => { resetComposer(true); });
|
||||
requestAnimationFrame(() => { resetComposer(shouldPreserveInput); });
|
||||
}
|
||||
}, [shouldSchedule, openCalendar, sendMessage, resetComposer]);
|
||||
|
||||
|
@ -105,6 +105,11 @@ const EmojiTooltip: FC<OwnProps> = ({
|
||||
}
|
||||
}, [addRecentEmoji, emojis, onEmojiSelect, selectedIndex]);
|
||||
|
||||
const handleClick = useCallback((native: string, id: string) => {
|
||||
onEmojiSelect(native);
|
||||
addRecentEmoji({ emoji: id });
|
||||
}, [addRecentEmoji, onEmojiSelect]);
|
||||
|
||||
useEffect(() => (isOpen ? captureKeyboardListeners({
|
||||
onEsc: onClose,
|
||||
onLeft: (e: KeyboardEvent) => handleArrowKey(-1, e),
|
||||
@ -138,7 +143,7 @@ const EmojiTooltip: FC<OwnProps> = ({
|
||||
key={emoji.id}
|
||||
emoji={emoji}
|
||||
focus={selectedIndex === index}
|
||||
onClick={onEmojiSelect}
|
||||
onClick={handleClick}
|
||||
/>
|
||||
))
|
||||
) : shouldRender ? (
|
||||
|
@ -32,7 +32,7 @@ export type OwnProps = {
|
||||
onLoad: () => void;
|
||||
onClose: () => void;
|
||||
onEmojiSelect: (emoji: string) => void;
|
||||
onStickerSelect: (sticker: ApiSticker) => void;
|
||||
onStickerSelect: (sticker: ApiSticker, shouldPreserveInput?: boolean) => void;
|
||||
onGifSelect: (gif: ApiVideo) => void;
|
||||
onRemoveSymbol: () => void;
|
||||
onSearchOpen: (type: 'stickers' | 'gifs') => void;
|
||||
@ -114,6 +114,10 @@ const SymbolMenu: FC<OwnProps & StateProps> = ({
|
||||
onSearchOpen(type);
|
||||
}, [onClose, onSearchOpen]);
|
||||
|
||||
const handleStickerSelect = useCallback((sticker: ApiSticker) => {
|
||||
onStickerSelect(sticker, true);
|
||||
}, [onStickerSelect]);
|
||||
|
||||
const lang = useLang();
|
||||
|
||||
const { canSendStickers, canSendGifs } = allowedAttachmentOptions;
|
||||
@ -133,7 +137,7 @@ const SymbolMenu: FC<OwnProps & StateProps> = ({
|
||||
className="picker-tab"
|
||||
loadAndPlay={canSendStickers ? isOpen && (isActive || isFrom) : false}
|
||||
canSendStickers={canSendStickers}
|
||||
onStickerSelect={onStickerSelect}
|
||||
onStickerSelect={handleStickerSelect}
|
||||
/>
|
||||
);
|
||||
case SymbolMenuTabs.GIFs:
|
||||
|
Loading…
Reference in New Issue
Block a user