Documentation#131
Conversation
|
⏭️ No files to mutate for |
|
⏭️ No files to mutate for |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 100% | 905/905 |
| 🟢 | Branches | 99.63% | 266/267 |
| 🟢 | Functions | 97.75% | 217/222 |
| 🟢 | Lines | 100% | 869/869 |
Test suite run success
475 tests passing in 25 suites.
Report generated by 🧪jest coverage report action from 5c5e5be
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 100% | 128/128 |
| 🟢 | Branches | 100% | 46/46 |
| 🟢 | Functions | 100% | 27/27 |
| 🟢 | Lines | 100% | 119/119 |
Test suite run success
73 tests passing in 7 suites.
Report generated by 🧪jest coverage report action from 5c5e5be
|
⏭️ No files to mutate for |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 92.51% | 358/387 |
| 🟢 | Branches | 85.51% | 118/138 |
| 🟢 | Functions | 98.15% | 53/54 |
| 🟢 | Lines | 92.41% | 353/382 |
Test suite run success
117 tests passing in 7 suites.
Report generated by 🧪jest coverage report action from 5c5e5be
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟡 | Statements | 70.97% | 22/31 |
| 🔴 | Branches | 20% | 1/5 |
| 🟡 | Functions | 75% | 6/8 |
| 🟡 | Lines | 68.97% | 20/29 |
Test suite run success
4 tests passing in 1 suite.
Report generated by 🧪jest coverage report action from 5c5e5be
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 96.43% | 27/28 |
| 🟢 | Branches | 86.96% | 20/23 |
| 🟢 | Functions | 100% | 5/5 |
| 🟢 | Lines | 96.43% | 27/28 |
Test suite run success
11 tests passing in 2 suites.
Report generated by 🧪jest coverage report action from 5c5e5be
There was a problem hiding this comment.
Pull request overview
Adds a new documentation set for the @editorjs/document-model monorepo, describing architecture boundaries, the data model, event system, plugin/tool lifecycle, input handling flows, and collaboration/OT mechanics, with supporting Mermaid diagrams and updated entry-point READMEs.
Changes:
- Introduces new docs pages under
docs/covering architecture, model, events, plugins/tools, input handling, and collaboration. - Adds Mermaid diagrams under
docs/diagrams/to visualize key flows (lifecycle, events catalog, OT, undo/redo, selection, formatting, etc.). - Updates root
README.mdand adds a docs maintenance agent instruction file at.github/agents/docs-updater.md.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
docs/plugins.md |
Documents plugin/tool registration, initialization sequence, and EditorAPI surface. |
docs/model.md |
Documents the model tree, mutation/event invariants, caret/selection concepts, and Index. |
docs/input-handling.md |
Documents the typing/selection pipeline and adapter interactions. |
docs/events.md |
Documents model vs core/UI event transports and event reference tables. |
docs/collaboration.md |
Documents OT flow, wire protocol, batching, and undo/redo behavior. |
docs/architecture.md |
Documents package layering and dependency rules with a high-level overview diagram link. |
docs/README.md |
Provides a guided reading order, lifecycle summary, and canonical terminology glossary. |
docs/diagrams/architecture-overview.mmd |
High-level package/class relationship diagram. |
docs/diagrams/plugin-lifecycle-flow.mmd |
Sequence diagram for Core/plugins/tools initialization lifecycle. |
docs/diagrams/model-tree-structure.mmd |
Class diagram for model/document/caret structures. |
docs/diagrams/events-catalog.mmd |
Class diagram cataloging event classes by transport/package. |
docs/diagrams/block-adapter-input-flow.mmd |
Sequence diagram for block insertion + adapter/input registration + typing flow. |
docs/diagrams/caret-selection-flow.mmd |
Sequence diagram for selection tracking and selection-changed signaling. |
docs/diagrams/inline-formatting-flow.mmd |
Sequence diagram for inline tool application and targeted DOM rerendering. |
docs/diagrams/collaboration-ot-flow.mmd |
Sequence diagram for handshake, local/remote ops, and OT transformation. |
docs/diagrams/undo-redo-flow.mmd |
Sequence diagram for batching and undo/redo inversion/apply. |
README.md |
Expands repo overview with package list, docs links, and dev commands. |
.github/agents/docs-updater.md |
Adds a process/style guide for keeping docs/diagrams synced with code changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| | Method | Description | | ||
| |---|---| | ||
| | `insert(type?, data?, index?, focus?, replace?)` | Insert a block of the given tool type | |
| - `core` wires runtime dependencies; it should be the only orchestrator. | ||
| - `model` does not depend on DOM concerns. | ||
| - `dom-adapters` and `collaboration-manager` observe/apply model changes through public APIs and events. | ||
| - `ui` depends on `sdk` only; it is registered as an `EditorjsPlugin` via `core.use()`. |
| - `EditorjsPlugin`: general UI/behavior plugin registered via `core.use()` with `PluginType.Plugin`. | ||
| - `UiComponentType`: reserved string keys for UI component slots (`shell`, `blocks`, `inline-toolbar`, `toolbox`, `toolbar`). These name components in the UI layer but are **not** used as arguments to `core.use()` — plugins are registered by `PluginType` or `ToolType` values. |
| Plugins-->>Core: [[SomeTool, settings], ...] | ||
| Core->>ToolsManager: prepareTools(blockTools, inlineTools, blockTunes) | ||
| loop for each tool | ||
| ToolsManager->>Tool: Tool.prepare(toolName, config) |
| detail.index: SerializedIndex or null | ||
| detail.userId: string or number | ||
| } | ||
| class CaretManagerCaretAddedEvent { | ||
| <<CustomEvent~CaretSerialized~>> | ||
| detail.index: SerializedIndex | ||
| detail.userId: string or number | ||
| } | ||
| class CaretManagerCaretRemovedEvent { | ||
| <<CustomEvent~CaretSerialized~>> |
| | `BlockAddedCoreEvent` | `core:block-added` | `{ tool, data, index, ui: HTMLElement }` | `BlockRenderer` | | ||
| | `BlockRemovedCoreEvent` | `core:block-removed` | `{ tool, index }` | `BlockRenderer` | | ||
| | `ToolLoadedCoreEvent` | `core:tool-loaded` | `{ tool: ToolFacadeClass }` | `ToolsManager` | | ||
| | `SelectionChangedCoreEvent` | `core:selection-changed` | `{ index, availableInlineTools, fragments }` | `SelectionManager` | |
| | `SelectionChangedCoreEvent` | `core:selection-changed` | `{ index, availableInlineTools, fragments }` | `SelectionManager` | | ||
| | `UndoCoreEvent` | `core:undo` | — | `BlocksUI` (Cmd/Ctrl+Z) | | ||
| | `RedoCoreEvent` | `core:redo` | — | `BlocksUI` (Cmd/Ctrl+Shift+Z) | | ||
| | `BeforeInputUIEvent` | `ui:before-input` | `{ data, inputType, targetRanges, isCrossInputSelection }` | `BlocksUI` | |
| %% ── Constructor ────────────────────────────────── | ||
| Dev->>Core: new Core(config) | ||
| Core->>IoC: bind EditorConfig, EventBus, EditorJSModel, ToolsManager | ||
| Core->>Plugins: bind DOMAdapters, Paragraph, Bold, Italic, Link, ShortcutsPlugin |
| %% ── await initialize() ─────────────────────────── | ||
| Dev->>Core: await initialize() | ||
|
|
||
| Core->>IoC: bind TOKENS.Adapter as toDynamicValue(ctx => new Adapter(model, config, api, eventBus)) |
|
|
||
| Core->>IoC: get SelectionManager, BlocksManager, BlockRenderer | ||
|
|
||
| Core->>EditorJSModel: initializeDocument(blocks) |
All generated, then fact-check by another model. I skimmed, looks legit.
Leave your suggestions, I'll feed it back to AI!