/** * Editor layer types. Sync-backend-specific payloads live beside each editor * under `editors//`; only that editor reads `EditorBinding.payload`. */ import type { ComponentType } from 'react'; /** Sync/editor backend id. */ export type EditorKind = 'automerge'; /** * Editor rendering mode: * - `edit` — live preview (raw syntax reveals near the cursor for editing). * - `view` — reading mode (everything stays rendered; read-only). */ export type EditorMode = 'edit' | 'view'; export type EditorBinding = { kind: EditorKind; payload: unknown; }; /** Props passed from workspaces into every registered editor component. */ export type EditorProps = { binding: EditorBinding; className?: string; placeholder?: string; /** Rendering mode for this view; defaults to `edit`. */ mode?: EditorMode; /** * Called when a link to an internal (schemeless) target is activated — the raw * link string, for the workspace to resolve against the current document and * open. External links (with a URI scheme) are opened by the editor itself. */ onOpenLink?: (target: string) => void; }; /** * A registered editor: UI for one sync method, keyed by `kind`. * Implementations live under `editors//` and are listed in `registry.ts`. */ export type Editor = { readonly kind: EditorKind; readonly Component: ComponentType; };