From 81d4a718857b2427e688a5b063e600c3c18575b6 Mon Sep 17 00:00:00 2001 From: Peifan Li Date: Sat, 20 Dec 2025 23:34:09 -0500 Subject: [PATCH] feat: Add paste functionality to search input --- .../src/components/Header/SearchInput.tsx | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Header/SearchInput.tsx b/frontend/src/components/Header/SearchInput.tsx index 163a297..3260905 100644 --- a/frontend/src/components/Header/SearchInput.tsx +++ b/frontend/src/components/Header/SearchInput.tsx @@ -1,4 +1,4 @@ -import { Clear, Search } from '@mui/icons-material'; +import { Clear, ContentPaste, Search } from '@mui/icons-material'; import { alpha, Box, @@ -40,6 +40,19 @@ const SearchInput: React.FC = ({ const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down('md')); + const handlePaste = async () => { + try { + const text = await navigator.clipboard.readText(); + setVideoUrl(text); + } catch (err) { + console.error('Failed to paste from clipboard:', err); + } + }; + + const handleClear = () => { + setVideoUrl(''); + }; + return ( = ({ }} slotProps={{ input: { + startAdornment: ( + + + + + + ), endAdornment: ( {isSearchMode && searchTerm && ( @@ -67,6 +93,17 @@ const SearchInput: React.FC = ({ )} + {videoUrl && ( + + + + )}