Skip to content

Documentation#131

Open
gohabereg wants to merge 1 commit intofix/inputs-registrationfrom
chore/docs
Open

Documentation#131
gohabereg wants to merge 1 commit intofix/inputs-registrationfrom
chore/docs

Conversation

@gohabereg
Copy link
Copy Markdown
Member

AISlopWarning

All generated, then fact-check by another model. I skimmed, looks legit.

Leave your suggestions, I'll feed it back to AI!

@gohabereg gohabereg requested a review from Copilot April 29, 2026 23:23
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

⏭️ No files to mutate for ./packages/model

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

⏭️ No files to mutate for ./packages/core

@github-actions
Copy link
Copy Markdown

Coverage report for ./packages/model

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

@github-actions
Copy link
Copy Markdown

Coverage report for ./packages/core

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

⏭️ No files to mutate for ./packages/dom-adapters

@github-actions
Copy link
Copy Markdown

Coverage report for ./packages/collaboration-manager

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

@github-actions
Copy link
Copy Markdown

Coverage report for ./packages/ot-server

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

@github-actions
Copy link
Copy Markdown

Coverage report for ./packages/dom-adapters

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md and 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.

Comment thread docs/plugins.md

| Method | Description |
|---|---|
| `insert(type?, data?, index?, focus?, replace?)` | Insert a block of the given tool type |
Comment thread docs/architecture.md
- `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()`.
Comment thread docs/README.md
Comment on lines +59 to +60
- `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)
Comment on lines +86 to +95
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~>>
Comment thread docs/events.md
Comment on lines +43 to +46
| `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` |
Comment thread docs/events.md
| `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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants