/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/app/src/components/prompt-input/paste.ts
24 строки
613 B
Shoubhit Dash
fix(app): handle multiline web paste in prompt composer (#17509)
14 мар 2026, 20:21
Не верифицирован
14 мар 2026, 20:21
689d9e1
Код
Авторство
О чём код?
const LARGE_PASTE_CHARS = 8000 const LARGE_PASTE_BREAKS = 120 function largePaste(text: string) { if (text.length >= LARGE_PASTE_CHARS) return true let breaks = 0 for (const char of text) { if (char !== "\n") continue breaks += 1 if (breaks >= LARGE_PASTE_BREAKS) return true } return false } export function normalizePaste(text: string) { if (!text.includes("\r")) return text return text.replace(/\r\n?/g, "\n") } export function pasteMode(text: string) { if (largePaste(text)) return "manual" if (text.includes("\n") || text.includes("\r")) return "manual" return "native" }