fix(scripts): пробел в Monaco-редакторе скриптов больше не блокируется
Some checks failed
CI / Lint (pull_request) Failing after 6s
CI / Build (pull_request) Failing after 9s
CI / PR size check (pull_request) Successful in 15s
CI / Secret scan (pull_request) Successful in 3m48s
CI / Deploy to S1 + S2 (pull_request) Has been skipped

BabylonScene.onKeyDown глобально перехватывал Space (preventDefault для
прокрутки страницы при WASD-навигации камеры). isTypingTarget проверял
только input/textarea/contentEditable — но Monaco роутит keydown через
свой внутренний div, и e.target оказывается не textarea, а
.monaco-editor-container div.

Фикс: добавлена проверка target.closest('.monaco-editor') — если фокус
в Monaco, считаем что юзер печатает и не глотаем клавиши.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
МИН 2026-05-29 11:50:09 +03:00
parent f4983bf36d
commit 0bcbb89664

View File

@ -2352,6 +2352,11 @@ export class BabylonScene {
const tag = (target.tagName || '').toLowerCase(); const tag = (target.tagName || '').toLowerCase();
if (tag === 'input' || tag === 'textarea' || tag === 'select') return true; if (tag === 'input' || tag === 'textarea' || tag === 'select') return true;
if (target.isContentEditable) return true; if (target.isContentEditable) return true;
// Monaco-редактор — у его внутренних элементов tagName бывает 'div',
// фокус живёт на скрытой textarea, но в зависимости от роутинга
// событий e.target может оказаться родительским div. Проверяем
// принадлежность дереву Monaco — там точно идёт набор текста.
if (typeof target.closest === 'function' && target.closest('.monaco-editor')) return true;
return false; return false;
}; };