From a853c714fd050bb24ba6b7c49f2caa372216fc28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=84=B1=EA=B2=BD?= Date: Wed, 22 Jul 2026 15:52:45 +0900 Subject: [PATCH] =?UTF-8?q?url=EC=9E=85=EB=A0=A5=20=EC=A0=95=EC=A0=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SearchInputForm.tsx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/components/SearchInputForm.tsx b/src/components/SearchInputForm.tsx index 0b36ccd..7520a4d 100644 --- a/src/components/SearchInputForm.tsx +++ b/src/components/SearchInputForm.tsx @@ -174,6 +174,26 @@ const SearchInputForm: React.FC = ({ } }; + // 모바일 키보드 클립보드 추천 등 paste 이벤트 없이 여러 글자가 한 번에 들어오는 경우 처리 + const handleChange = (value: string) => { + const isBulkInsert = value.length - inputValue.length > 1; + if (isBulkInsert) { + const extracted = extractUrl(value); + if (extracted && extracted !== value.trim()) { + applyInputChange(sanitizeUrlInput(extracted)); + return; + } + if (isUrlLike(value)) { + const sanitized = sanitizeUrlInput(value); + if (sanitized !== value) { + applyInputChange(sanitized); + return; + } + } + } + applyInputChange(value); + }; + const handlePaste = (e: React.ClipboardEvent) => { const pastedText = e.clipboardData.getData('text'); @@ -227,7 +247,7 @@ const SearchInputForm: React.FC = ({ applyInputChange(e.target.value)} + onChange={(e) => handleChange(e.target.value)} onPaste={handlePaste} onFocus={() => { setIsFocused(true);