← Craft adatlapja
AgentCraft
Szerkesztő-kijelölés, fókusz és bevitel
Szerkesztés, eszköztárhasználat és összetett szövegbevitel közben megőrzi a kurzor értelmes helyét.
selection-focus-input-handling
Nézd meg, miben segítMikor hasznos?
Akkor használd, ha vizuális szerkesztőd elveszíti a kijelölést vagy elrontja az összetett karaktereket.
Miben segít neked?
- Átvezeti a kijelölést beszúráson, bontáson és formázáson.
- Kiszámítható fókuszt ad blokktörlés és eszköztár után.
- Aktív IME-bevitel alatt halasztja a szerkezeti gyorsműveletet.
Például ezt kérheted
Javítsd a blokkeditort megmaradó formázási kijelöléssel, logikus törlés utáni fókusszal és zavartalan összetett bevitellel. Formázz kijelölt szöveget, töröld blokkját, majd írj összetett karaktert. A kurzor kiszámíthatóan lépjen, a szerkezeti gyorsbillentyű ne szakítsa meg a bevitelt.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
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?
Csomagban lévő fájlok 1
SKILL.md
