Szerkesztő dokumentummodellje
Egyetlen hiteles dokumentummodellt és strukturált parancsokat alakít ki versengő DOM- és alkalmazásállapot helyett.
editor-document-model-commands
Nézd meg, miben segítMikor hasznos?
Akkor használd, ha szerkesztés sérti a szerkezetet, kijelölést vagy blokkazonosítót.
Miben segít neked?
- Elválasztja a dokumentumot, kijelölést, felületet és átmeneti interakcióállapotot.
- Sémaszabályokat és stabil csomópont-azonosítókat határoz meg.
- Ellenőrzött tranzakciókon vezeti át a szerkesztést, meghatározott előzménykezeléssel.
Például ezt kérheted
Tervezz beágyazott listaelem-mozgatást egyetlen paranccsal, a kijelölés és visszavonás megtartásával. Mozgass ki gyermekelemet a listából, vond vissza és ismételd meg. Az azonosító, érvényes beágyazás és kijelölés minden lépésben maradjon helyes.
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
Editor Document Model & Commands
Use this skill when designing or modifying the state architecture, schema rules, and mutation commands of a visual editor, block editor, or interactive workspace.
Single Authoritative Document Model (Haverbeke & Ousterhout)
- Never Let the DOM and Application State Compete as Primary Sources of Truth:
- Maintain a canonical, serializable document model (an immutable tree or normalized node map) as the single owner of content.
- The view is a projection of document state, and edits dispatch structured commands / transactions ($\text{State} + \text{Transaction} \to \text{State}'$). Never mutate the DOM directly behind the editor library's back.
- Strictly Separate the Four Editor State Layers:
- Document Content State: Blocks, inline nodes, marks, attributes, and hierarchy (persisted and tracked by undo/redo).
- Selection & Cursor State: Active block/text selection, anchor/head positions, and focus target (ephemeral, bound to document positions).
- View / UI State: Zoom, pan, collapsed panels, hover guides, active toolbars, and drag indicators (never persisted as document content).
- Persistence / Save State:
clean,dirty,saving,saved,error,conflict, and last-acknowledged revision version.
Schema Rules, Stable IDs & Structural Integrity
- Stable Block Identifiers: Assign every addressable block or canvas element a stable unique ID (
id). - Parent-Child & Content Constraints: Enforce explicit schema rules defining which block types may nest inside which containers, required child nodes, and allowed inline marks.
- Safe Duplication & Deletion:
- When duplicating or pasting a block subtree, mint fresh IDs for every cloned node and remap internal cross-references within the cloned subgraph.
- When deleting a node, clean up dangling references and ensure the document keeps at least one valid root block when required by the schema.
Transactional Command Pipeline
- Route every content modification—typing, block insertion, drag-and-drop move, inspector edit, paste, or slash-command transform—through explicit, composable transactions.
- Validate schema invariants before committing a transaction so invalid trees cannot enter editor state.
- Adapt to existing libraries (ProseMirror, Tiptap, Lexical, Slate, BlockNote) via their native extension, node, and command APIs rather than building a custom rich-text engine.
Checklist
- Is there a single authoritative document model separated from selection, view UI, and save state?
- Do all blocks carry stable IDs, with fresh IDs and remapped references generated on duplication?
- Are parent-child nesting rules and schema invariants enforced on every command and transaction?
- Do all edits flow through structured transactions rather than direct DOM or ad-hoc state mutations?
Csomagban lévő fájlok 1
SKILL.md
A skillcsomag bemutatása
editor-document-model-commands
editor-document-model-commands: Egységes dokumentummodellel, kijelöléssel, visszavonással, automatikus mentéssel és megbízható szerializálással épít vizuális és szövegszerkesztőket.
Összecsukás
editor-document-model-commands
editor-document-model-commands: Egységes dokumentummodellel, kijelöléssel, visszavonással, automatikus mentéssel és megbízható szerializálással épít vizuális és szövegszerkesztőket.
A teljes skillt és a hozzá tartozó fájlokat tartalmazza (1 fájl). Az alábbi eredeti leírás rögzíti a pontos alkalmazási területét.
A skill eredeti leírása (a forrás nyelvén)
Use when designing structured document schemas, separate editor state layers, stable block identifiers, and transactional commands for visual and block editors.
Telepítsd a skillt, nézd át a forrását és a megbízhatósági beállításait, majd engedélyezd a megfelelő projektben vagy ügynöknél.
Előfeltételek
- A számítógépedre telepített Orqestria.
