랜딩페이지 검색창 수정 .

subtitle
hbyang 2026-03-09 15:59:18 +09:00
parent fa4864e9ef
commit 388351e6d4
2 changed files with 23 additions and 4 deletions

View File

@ -207,14 +207,14 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
{/* 입력 필드 */} {/* 입력 필드 */}
<div className="url-input-field-container" ref={autocompleteRef}> <div className="url-input-field-container" ref={autocompleteRef}>
<input <input
type={searchType === 'url' ? 'url' : 'text'} type="text"
value={inputValue} value={inputValue}
onChange={(e) => { onChange={(e) => {
let value = e.target.value; let value = e.target.value;
// URL 모드일 때 앞에 붙은 텍스트 제거 (예: "[네이버 지도] https://...") // URL 모드일 때 URL만 추출 (예: "[네이버 지도] https://...")
if (searchType === 'url') { if (searchType === 'url') {
const urlMatch = value.match(/https?:\/\/.+/); const urlMatch = value.match(/https?:\/\/\S+/);
if (urlMatch && urlMatch[0] !== value) { if (urlMatch && urlMatch[0] !== value) {
value = urlMatch[0]; value = urlMatch[0];
} }

View File

@ -376,7 +376,16 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
type="text" type="text"
value={inputValue} value={inputValue}
onChange={(e) => { 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); setInputValue(value);
setHighlightedIndex(-1); // 입력 시 하이라이트 초기화 setHighlightedIndex(-1); // 입력 시 하이라이트 초기화
if (localError) setLocalError(''); if (localError) setLocalError('');
@ -391,6 +400,16 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
}, 300); }, 300);
} }
}} }}
onPaste={(e: React.ClipboardEvent<HTMLInputElement>) => {
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={() => { onFocus={() => {
setIsFocused(true); setIsFocused(true);
if (searchType === 'name' && autocompleteResults.length > 0) { if (searchType === 'name' && autocompleteResults.length > 0) {