Edit Topic: Add confirm edit on Enter for topics (#6947)

This commit is contained in:
Alexander Zinchuk 2026-05-15 18:37:51 +02:00
parent 94a382ca73
commit da6d2cf9df

View File

@ -95,6 +95,15 @@ const EditTopic: FC<OwnProps & StateProps> = ({
}); });
}, [chat, editTopic, iconEmojiId, title, topic]); }, [chat, editTopic, iconEmojiId, title, topic]);
const handleTitleKeyDown = useCallback((e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key !== 'Enter' || e.isComposing || isLoading || !isTouched) {
return;
}
e.preventDefault();
handleEditTopic();
}, [handleEditTopic, isLoading, isTouched]);
const handleCustomEmojiSelect = useCallback((emoji: ApiSticker) => { const handleCustomEmojiSelect = useCallback((emoji: ApiSticker) => {
if (!emoji.isFree && !isCurrentUserPremium && emoji.id !== DEFAULT_TOPIC_ICON_STICKER_ID) { if (!emoji.isFree && !isCurrentUserPremium && emoji.id !== DEFAULT_TOPIC_ICON_STICKER_ID) {
openPremiumModal({ initialSection: 'animated_emoji' }); openPremiumModal({ initialSection: 'animated_emoji' });
@ -146,6 +155,7 @@ const EditTopic: FC<OwnProps & StateProps> = ({
<InputText <InputText
value={title} value={title}
onChange={handleTitleChange} onChange={handleTitleChange}
onKeyDown={handleTitleKeyDown}
label={lang('lng_forum_topic_title')} label={lang('lng_forum_topic_title')}
disabled={isLoading} disabled={isLoading}
teactExperimentControlled teactExperimentControlled