url 붙혀넣기 수정 .

subtitle
hbyang 2026-03-09 13:10:55 +09:00
parent 3cbc48181b
commit 9fe03a66cb
1 changed files with 12 additions and 0 deletions

View File

@ -124,6 +124,17 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
} }
}; };
// 붙여넣기 시 URL만 추출
const handlePaste = (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]);
}
};
// 폼 제출 처리 // 폼 제출 처리
const handleSubmit = (e: React.FormEvent) => { const handleSubmit = (e: React.FormEvent) => {
e.preventDefault(); e.preventDefault();
@ -212,6 +223,7 @@ const UrlInputContent: React.FC<UrlInputContentProps> = ({ onAnalyze, onAutocomp
}, 300); }, 300);
} }
}} }}
onPaste={handlePaste}
onFocus={() => { onFocus={() => {
if (searchType === 'name' && autocompleteResults.length > 0) { if (searchType === 'name' && autocompleteResults.length > 0) {
setShowAutocomplete(true); setShowAutocomplete(true);