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) {