import type { Extension, Node, Mark } from "@tiptap/core"; import type { Awareness } from "y-protocols/awareness"; import type { Doc as YDoc } from "yjs"; import { type BubbleToolbarItem } from "./BubbleToolbar.js"; import { type RichMarkdownDialect, type RichMarkdownEditorPreset, type RichMarkdownCollabUser, type SharedEditorFeatures } from "./extensions.js"; import type { ImageUploadFn } from "./ImageExtension.js"; import { type SlashCommandItem } from "./SlashCommandMenu.js"; import { type UseCollabReconcileOptions } from "./useCollabReconcile.js"; export interface SharedRichEditorProps { value: string; onChange: (markdown: string) => void; onBlur?: () => void; contentUpdatedAt?: string | null; editable?: boolean; dialect?: RichMarkdownDialect; preset?: RichMarkdownEditorPreset; /** Toggle individual base extensions (tables/tasks/link/codeBlock/image). */ features?: SharedEditorFeatures; /** Show the Notion-style block grip and action menu. Defaults to `true`. */ dragHandle?: boolean; /** * Injectable image uploader for the shared image block. Used only when * `features.image` is on. Pass `uploadEditorImage` (the framework * `upload-image` action) for a real uploading image block. */ onImageUpload?: ImageUploadFn | null; /** * App-specific extensions (Notion nodes, media, drag handles, comment * anchors, …) appended after the shared base schema. */ extraExtensions?: Array; placeholder?: string; className?: string; editorClassName?: string; ariaLabel?: string; interactive?: boolean; /** * Yjs document for real-time multi-user editing. When provided, prose is * authored against the shared Y.Doc and mirrored back to `value` as markdown * (still the source of truth). When omitted, the editor is a plain controlled * `value`/`onChange` editor — the existing, non-collaborative behavior. */ ydoc?: YDoc | null; /** True after the collab provider has loaded persisted Y.Doc state. */ collabSynced?: boolean; /** Shared awareness instance for live cursors/presence. */ awareness?: Awareness | null; /** Current user info for the collaborative cursor label. */ user?: RichMarkdownCollabUser | null; /** * Disable StarterKit's built-in undo/redo for a controlled (non-collab) * editor whose host owns its own undo authority (see * {@link CreateSharedEditorExtensionsOptions.disableHistory}). Ignored when a * `ydoc` is present (Yjs always owns history then). Default `false`, so every * existing embedder is unchanged. */ disableHistory?: boolean; /** Override the slash-menu block command list. */ slashItems?: SlashCommandItem[]; /** Override the bubble-toolbar item builder. */ buildBubbleItems?: (editor: import("@tiptap/react").Editor, toggleLink: () => void) => BubbleToolbarItem[]; /** * Override how the editor's content is read into the canonical `value`. * Defaults to the tiptap-markdown storage reader. Apps with a custom on-disk * format (Content's NFM, the plan's `blocks[]` JSON) pass their serializer so * seed/reconcile/onChange all speak the same value space. */ getMarkdown?: (editor: import("@tiptap/react").Editor) => string; /** Override how the canonical `value` is applied into the editor (seed + reconcile). */ setContent?: (editor: import("@tiptap/react").Editor, value: string, options: { emitUpdate?: boolean; addToHistory?: boolean; }) => void; /** * Optional parser for surgical reconcile. Custom value formats that already * handle surgical writes inside `setContent` can pass `false` so the default * markdown parser never treats their source bytes as literal markdown. */ parseValue?: UseCollabReconcileOptions["parseValue"]; /** Canonicalize `value` for the echo / already-in-sync equality checks. */ normalizeValue?: (value: string) => string; /** Override the empty-doc seed predicate (see {@link useCollabReconcile}). */ shouldSeed?: (info: { value: string; currentMarkdown: string; fragmentLength: number; }) => boolean; /** Initial "applied" watermark (see {@link useCollabReconcile}). */ initialAppliedUpdatedAt?: string | null; /** Extra class on the editor wrapper (e.g. a drag-handle `wrapperSelector` hook). */ wrapperClassName?: string; /** * Fires once the editor instance exists. Lets a host capture the root * `editor.view` — e.g. to repaint the WHOLE document after a structural block * move (a column emptied and its container dissolved) that a surgical * per-region patch can't express, since the change is in the root doc itself. */ onEditorReady?: (editor: import("@tiptap/react").Editor) => void; } /** * The single shared rich markdown editor surface. Combines * {@link createSharedEditorExtensions} (schema + dialect-keyed markdown + * optional collab + app extras), {@link useCollabReconcile} (seed / reconcile / * lead-client logic), and the shared {@link SlashCommandMenu} + * {@link BubbleToolbar}. * * With no `ydoc` it is a controlled `value`/`onChange` single-user editor. * With a `ydoc` it binds the framework collaboration stack; markdown stays the * canonical saved representation while the Y.Doc is transient live state. */ export declare function SharedRichEditor({ value, onChange, onBlur, contentUpdatedAt, editable, dialect, preset, features, dragHandle, onImageUpload, extraExtensions, placeholder, className, editorClassName, ariaLabel, interactive, ydoc, collabSynced, awareness, user, disableHistory, slashItems, buildBubbleItems, getMarkdown, setContent, parseValue, normalizeValue, shouldSeed, initialAppliedUpdatedAt, wrapperClassName, onEditorReady, }: SharedRichEditorProps): import("react").JSX.Element; //# sourceMappingURL=SharedRichEditor.d.ts.map