# Edytor

> A collaborative block editor for Svelte 5: Notion-style blocks, plugins that can veto anything, and a Yjs v14 engine with a Cloudflare Durable Object server.

## Docs

- [Introduction](https://edytor-docs.beynar.workers.dev/docs): Edytor is a collaborative block editor for Svelte 5 with a plugin system, a Yjs v14 engine, and a Durable Object server.

## Getting started

- [Installation](https://edytor-docs.beynar.workers.dev/docs/getting-started): Install the edytor package in a Svelte 5 project and check the requirements for the editor, the CRDT entries and the server room.
- [Quick start](https://edytor-docs.beynar.workers.dev/docs/getting-started/quick-start): Build a working Edytor editor with the bundled plugins, an initial document, change handling and your own styles.
- [SvelteKit](https://edytor-docs.beynar.workers.dev/docs/getting-started/sveltekit): Use Edytor in SvelteKit, with readonly server rendering, client-only editable editors and headless document work on the server.
- [Entry points](https://edytor-docs.beynar.workers.dev/docs/getting-started/entry-points): The package entry points of edytor, what each exports, and where each can run, from the browser to Node and Cloudflare Workers, plus the Notion theme stylesheet.

## Concepts

- [Document model](https://edytor-docs.beynar.workers.dev/docs/concepts/document-model): The JSON shape of an Edytor document, with blocks, content, children, marks, inline blocks, ids and the rules the editor applies to them.
- [Blocks](https://edytor-docs.beynar.workers.dev/docs/concepts/blocks): Block kinds, nesting, void and island blocks, default children, and the kind catalogue that powers menus and markdown shortcuts.
- [The editor instance](https://edytor-docs.beynar.workers.dev/docs/concepts/editor-instance): The runtime Edytor object behind every view, its members, the Block, Text and InlineBlock handles, and how to read state reactively.

## Editor

- [The Edytor component](https://edytor-docs.beynar.workers.dev/docs/editor/edytor-component): Every prop of the Edytor component, with types and defaults, plus the snippet overrides for blocks, marks and inline blocks.
- [Selection](https://edytor-docs.beynar.workers.dev/docs/editor/selection): Read and set the editor selection, a value that is a caret or range, one inline block, or a set of blocks, and stage pending marks.
- [Editing programmatically](https://edytor-docs.beynar.workers.dev/docs/editor/commands): Change the document from code with handle commands or facade operations, read their results, group writes with transact, and move blocks.
- [Undo and redo](https://edytor-docs.beynar.workers.dev/docs/editor/history): How Edytor groups edits into undo steps, the undo and redo APIs, and how undo behaves when several people edit the same document.
- [Readonly mode](https://edytor-docs.beynar.workers.dev/docs/editor/readonly): Render a document without editing, what still works in a readonly view, and how to switch between readonly and editable.
- [Clipboard](https://edytor-docs.beynar.workers.dev/docs/editor/clipboard): How Edytor copies, cuts and pastes, the clipboard formats it writes, how pasted HTML becomes blocks and marks, and where plugins can step in.

## Plugins

- [Plugins](https://edytor-docs.beynar.workers.dev/docs/plugins): What an Edytor plugin is, how to pass plugins to the editor, how plugin order decides conflicts, and which plugins ship with the package.
- [Writing plugins](https://edytor-docs.beynar.workers.dev/docs/plugins/writing-plugins): The full plugin contract, every definition field and hook with its payload, and how to type snippets in your own plugins.
- [Operations](https://edytor-docs.beynar.workers.dev/docs/plugins/operations): How onBeforeOperation sees every edit as a command and its planned steps, and how to veto, replace or rewrite edits and react after them.
- [Example plugin](https://edytor-docs.beynar.workers.dev/docs/plugins/example-plugin): A complete plugin in one Svelte file, with a note block kind that has data and chrome, a keyboard mark, a hotkey, presets and an operation hook.
- [Rich text](https://edytor-docs.beynar.workers.dev/docs/plugins/rich-text): The rich text plugin's block kinds, marks, Notion hotkeys, placeholders and formatting helpers, including link and color sanitization.
- [Code](https://edytor-docs.beynar.workers.dev/docs/plugins/code): The code plugin adds code blocks made of editable lines, highlighted with TanStack Highlight, with tab, auto-pairing and copy.
- [Image](https://edytor-docs.beynar.workers.dev/docs/plugins/image): The image plugin adds Notion's image block, a void figure with an editable caption, embedded from a link or an upload you provide. It is on by default.
- [Block handles](https://edytor-docs.beynar.workers.dev/docs/plugins/block-handles): The block handles plugin adds a + button and a drag grip beside each block, with drag and drop, keyboard moves, a drop indicator and an activation hook for block menus.
- [Block menu](https://edytor-docs.beynar.workers.dev/docs/plugins/block-menu): The block menu plugin opens Notion's block menu when you click a block handle's grip, with search, Turn into, Duplicate, Move and Delete, and binds Mod+D to duplicate.
- [Slash menu](https://edytor-docs.beynar.workers.dev/docs/plugins/slash-menu): The slash menu plugin opens a filtered command menu when you type a slash, listing every block kind preset and every plugin command.
- [Toolbar](https://edytor-docs.beynar.workers.dev/docs/plugins/toolbar): The toolbar plugin shows Notion's floating toolbar over text selections, with Turn into, a link panel, a button for every mark that declares one, and text and background colors.
- [Markdown shortcuts](https://edytor-docs.beynar.workers.dev/docs/plugins/markdown-shortcuts): The markdown shortcuts plugin converts a block when you type a prefix such as "# " or "- " at its start, and formats text typed as **bold**, *italic*, `code` or ~strike~, as in Notion.
- [Arrow move](https://edytor-docs.beynar.workers.dev/docs/plugins/arrow-move): The arrow move plugin moves the caret's block with Mod+Shift and the arrow keys, as in Notion, and the selected blocks with Mod and the arrow keys.
- [Mention](https://edytor-docs.beynar.workers.dev/docs/plugins/mention): The mention plugin in the repository is a reference implementation of an inline atom inserted by an operation hook, not an export of the package.

## Customization

- [Blocks](https://edytor-docs.beynar.workers.dev/docs/customization/blocks): Define block kinds with a BlockDefinition, render them with snippets, mark chrome as void, and declare presets for menus and markdown shortcuts.
- [Marks](https://edytor-docs.beynar.workers.dev/docs/customization/marks): Define text marks with a tag or a snippet, give them values with sanitized attributes, and toggle marks and pending marks from code.
- [Inline blocks](https://edytor-docs.beynar.workers.dev/docs/customization/inline-blocks): Define inline atoms such as mentions, render them with snippets, insert and remove them from code, and export them as plain text.
- [Placeholder](https://edytor-docs.beynar.workers.dev/docs/customization/placeholder): Show placeholder text in empty blocks with a string, a function of the block or the bundled Notion placeholders, and style it through the data-placeholder attribute.
- [Styling](https://edytor-docs.beynar.workers.dev/docs/customization/styling): The Notion theme, the DOM the editor renders, the stable data attributes to style it with, the overlay layer for chrome, and how to lay out nested blocks.
- [Menus and handles](https://edytor-docs.beynar.workers.dev/docs/customization/menus): Replace the markup of the slash menu, the selection toolbar, the block menu and the block handles with your own Svelte snippets, while the plugins keep the behavior.
- [Hotkeys](https://edytor-docs.beynar.workers.dev/docs/customization/hotkeys): The default keymap, the chord syntax for plugin and app hotkeys, precedence, and how to override or disable a default binding.

## Collaboration

- [Collaboration](https://edytor-docs.beynar.workers.dev/docs/collaboration): How edytor shares one document between views, browser tabs and people, and which setup to pick.
- [Documents](https://edytor-docs.beynar.workers.dev/docs/collaboration/documents): Create, load, share and destroy an EdytorDocument, and understand when it is ready to edit.
- [Persistence](https://edytor-docs.beynar.workers.dev/docs/collaboration/persistence): Keep documents in the browser with IndexedDB, work offline, sync open tabs, and clear the local copy.
- [WebSocket](https://edytor-docs.beynar.workers.dev/docs/collaboration/websocket): Connect a document to the edytor room with createWebsocketSync, and follow connection, saved state and refusals.
- [Presence](https://edytor-docs.beynar.workers.dev/docs/collaboration/presence): Show who is editing, with names, colors, remote carets and selections, through the document's awareness.
- [Concurrent editing](https://edytor-docs.beynar.workers.dev/docs/collaboration/concurrent-editing): What people see when they delete, undo, split, merge and move the same content at the same time.

## Server

- [Server quick start](https://edytor-docs.beynar.workers.dev/docs/server/quick-start): Deploy the edytor Durable Object room on Cloudflare and connect your editor to it in a few steps.
- [Authorization](https://edytor-docs.beynar.workers.dev/docs/server/authorization): Decide who may open a document with authorize, bind client ids to users, and grant read-only access.
- [The room](https://edytor-docs.beynar.workers.dev/docs/server/room): What the DocumentRoom Durable Object enforces, how it stores and acknowledges edits, and the limits to plan for.
- [Your own Durable Object](https://edytor-docs.beynar.workers.dev/docs/server/extending): Host a document in any Durable Object with attachDocument, load it from and save it to your own storage (R2, KV, D1), and edit it on the server.
- [Protocol](https://edytor-docs.beynar.workers.dev/docs/server/protocol): The edytor wire format and the helpers edytor/crdt/edytor exports for writing your own sync client or server.

## Reference

- [Document API](https://edytor-docs.beynar.workers.dev/docs/reference/document-api): Reference for the document facade, its operations and results, order and capability queries, change events and attribution.
- [CRDT entry points](https://edytor-docs.beynar.workers.dev/docs/reference/crdt): What edytor/crdt and edytor/crdt/edytor export, what bindCrdt(Y) returns, and when you need them instead of the document API.
- [Troubleshooting](https://edytor-docs.beynar.workers.dev/docs/reference/troubleshooting): What each thrown error means, how a sync connection ends and why, and the refused status a command returns instead of throwing.
- [Migration](https://edytor-docs.beynar.workers.dev/docs/reference/migration): Import documents stored by the v13 (yjs) engine, and upgrade code written for edytor 0.0.11.
- [Limitations](https://edytor-docs.beynar.workers.dev/docs/reference/limitations): What edytor does not provide, what is not finished, and the known edge cases of collaborative editing.

## Agent resources

- [llms-full.txt](https://edytor-docs.beynar.workers.dev/llms-full.txt): The full Markdown of every page in one file.
- [Page Markdown](https://edytor-docs.beynar.workers.dev/index.md): Append `.md` to any page URL to fetch that page as raw Markdown.
- [JSON API](https://edytor-docs.beynar.workers.dev/api/docs/pages.json): Page index of the JSON docs API; each entry links the page's JSON and Markdown forms. Described by the OpenAPI document at https://edytor-docs.beynar.workers.dev/openapi.json.
- [MCP server](https://edytor-docs.beynar.workers.dev/mcp): Streamable HTTP Model Context Protocol server with search_docs, get_page, list_pages, and get_navigation tools, plus every page as a resource. Discovery document: https://edytor-docs.beynar.workers.dev/.well-known/mcp.json
- [API catalog](https://edytor-docs.beynar.workers.dev/.well-known/api-catalog): RFC 9727 linkset of the APIs documented here.
- [AI catalog](https://edytor-docs.beynar.workers.dev/.well-known/ai-catalog.json): ARD manifest of the agent-facing resources on this site (MCP server, skills, APIs).
- [agent-readability.json](https://edytor-docs.beynar.workers.dev/agent-readability.json): Manifest of every agent-facing artifact on this site.
- [Sitemap](https://edytor-docs.beynar.workers.dev/sitemap.xml): Every indexable page URL with its last-modified date.
