← Zurück zu Entwickler interner Systeme
Entdecke, wie der Skill hilft
Editorauswahl, Fokus und Eingabe
Erhält Cursorposition und Tastaturverhalten bei Bearbeitung, Werkzeugleisten und internationaler Texteingabe.
selection-focus-input-handling
Teammitglieder mit diesem Skill
Wann ist der Skill hilfreich?
Nutze diesen Skill bei verlorener Auswahl oder gestörter Zeichenkomposition.
Wobei hilft er dir?
- Überträgt Auswahl durch Einfügen, Teilen, Zusammenführen und Formatieren.
- Stellt nachvollziehbaren Fokus nach Löschen oder Werkzeugnutzung her.
- Verschiebt strukturelle Kürzel während aktiver IME-Eingabe.
Das könntest du fragen
Repariere unseren Blockeditor mit erhaltener Formatauswahl, sinnvollem Fokus nach Löschen und ungestörter Texteingabe. Formatiere markierten Text, lösche den Block und nutze Zeichenkomposition. Der Cursor folgt vorhersehbar; Strukturkürzel unterbrechen keine laufende Komposition.
Ausführliche Dokumentation
Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.
Weniger anzeigen
Selection, Focus & Input Handling
Use this skill when implementing cursor management, text/block selection, focus restoration, IME input composition, or keyboard navigation in visual editors.
Predictable Selection & Focus Lifecycle
- Preserve Selection Across Renders and Edits:
- Never reset the caret to the start or end of a block on re-render by binding
contenteditabledirectly to reactive state without selection mapping. - Use the editor library's position mapping (
Selection,ResolvedPos, node key + offset) so insertions, splits, merges, and formatting changes keep the caret in the exact expected logical position.
- Never reset the caret to the start or end of a block on re-render by binding
- Deterministic Focus After Structural Operations:
- Split (
Enter): Move focus and caret to the start of the newly created block. - Merge / Backspace at Block Start: Join with the preceding text block and place the caret at the join boundary, or select an preceding atomic block (
NodeSelection). - Delete Block: Move focus predictably to the adjacent previous or next block; if the last block is deleted, insert an empty default block and focus it.
- Inspector / Toolbar Interaction: Modifying block attributes from a floating toolbar or side panel must either preserve the editor selection or restore focus cleanly when the user returns to typing.
- Split (
IME Composition & International Input Safety
- Never Interrupt Active IME Sessions (
isComposing):- Users typing CJK characters, dead-key accents, or mobile predictive text rely on
compositionstart$\to$compositionupdate$\to$compositionend. - Never trigger slash menus, Markdown auto-format rules (
inputRules), block splits onEnter, or state-resetting re-renders whileevent.isComposingorview.composingis true; defer structural transforms untilcompositionend.
- Users typing CJK characters, dead-key accents, or mobile predictive text rely on
Keyboard Shortcuts & Navigation Boundaries
- Respect Platform & Browser Shortcuts:
- Only call
event.preventDefault()when the editor actively handles the shortcut in the current context. Never swallow system shortcuts (tab switching, browser zoom, screen-reader navigation, OS clipboard/window commands).
- Only call
- Isolating Boundaries:
- Handle arrow-key and
Tabnavigation cleanly across nested blocks, tables, code blocks, and embedded widgets so focus never gets trapped or jumps unexpectedly.
- Handle arrow-key and
Checklist
- Does the caret remain in the exact logical position across re-renders, splits, merges, and toolbar formatting?
- Is focus placed deterministically after block creation, deletion, reordering, and modal/popover closure?
- Are
isComposing/ IME composition events respected without premature shortcut or input-rule interception? - Are native browser and OS keyboard shortcuts preserved whenever the editor does not explicitly handle them?
Enthaltene Dateien 1
SKILL.md
