From 388351e6d4c6e636b73d65e47ac61a6c7d08d016 Mon Sep 17 00:00:00 2001 From: hbyang Date: Mon, 9 Mar 2026 15:59:18 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9E=9C=EB=94=A9=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=20=EA=B2=80=EC=83=89=EC=B0=BD=20=EC=88=98=EC=A0=95=20.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Dashboard/UrlInputContent.tsx | 6 +++--- src/pages/Landing/HeroSection.tsx | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/pages/Dashboard/UrlInputContent.tsx b/src/pages/Dashboard/UrlInputContent.tsx index 525f44d..6bfc84c 100644 --- a/src/pages/Dashboard/UrlInputContent.tsx +++ b/src/pages/Dashboard/UrlInputContent.tsx @@ -207,14 +207,14 @@ const UrlInputContent: React.FC = ({ onAnalyze, onAutocomp {/* 입력 필드 */}
{ let value = e.target.value; - // URL 모드일 때 앞에 붙은 텍스트 제거 (예: "[네이버 지도] https://...") + // URL 모드일 때 URL만 추출 (예: "[네이버 지도] https://...") if (searchType === 'url') { - const urlMatch = value.match(/https?:\/\/.+/); + const urlMatch = value.match(/https?:\/\/\S+/); if (urlMatch && urlMatch[0] !== value) { value = urlMatch[0]; } diff --git a/src/pages/Landing/HeroSection.tsx b/src/pages/Landing/HeroSection.tsx index 6320fe0..4318e86 100755 --- a/src/pages/Landing/HeroSection.tsx +++ b/src/pages/Landing/HeroSection.tsx @@ -376,7 +376,16 @@ const HeroSection: React.FC = ({ onAnalyze, onAutocomplete, on type="text" value={inputValue} onChange={(e) => { - const value = e.target.value; + let value = e.target.value; + + // URL 모드일 때 URL만 추출 (예: "[네이버 지도] https://...") + if (searchType === 'url') { + const urlMatch = value.match(/https?:\/\/\S+/); + if (urlMatch && urlMatch[0] !== value) { + value = urlMatch[0]; + } + } + setInputValue(value); setHighlightedIndex(-1); // 입력 시 하이라이트 초기화 if (localError) setLocalError(''); @@ -391,6 +400,16 @@ const HeroSection: React.FC = ({ onAnalyze, onAutocomplete, on }, 300); } }} + onPaste={(e: React.ClipboardEvent) => { + if (searchType !== 'url') return; + const pasted = e.clipboardData.getData('text'); + const urlMatch = pasted.match(/https?:\/\/[^\s]+/); + if (urlMatch) { + e.preventDefault(); + setInputValue(urlMatch[0]); + if (localError) setLocalError(''); + } + }} onFocus={() => { setIsFocused(true); if (searchType === 'name' && autocompleteResults.length > 0) {