← Zurück zu Craft
AgentCraft

Skill · Version 1.0.0

Editorauswahl, Fokus und Eingabe

Erhält Cursorposition und Tastaturverhalten bei Bearbeitung, Werkzeugleisten und internationaler Texteingabe.

selection-focus-input-handling

Entdecke, wie der Skill hilft

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.

Details…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

  1. Preserve Selection Across Renders and Edits:
    • Never reset the caret to the start or end of a block on re-render by binding contenteditable directly 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.
  2. 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.

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 on Enter, or state-resetting re-renders while event.isComposing or view.composing is true; defer structural transforms until compositionend.

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).
  • Isolating Boundaries:
    • Handle arrow-key and Tab navigation cleanly across nested blocks, tables, code blocks, and embedded widgets so focus never gets trapped or jumps unexpectedly.

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