blockcn

Public API

Every export of the editor entry, grouped by registry item.

Generated from the TSDoc on editor/src/index.ts. scripts/check-public-docs.mjs fails when an export has no summary or no @category, and when this page is out of date. The longer guide is API reference.

editor-core

ExportSummary
createEditorExtensionsCore extensions, with core and starterKit overrides.
CoreOptionsWhich core blocks to include, omit, or configure. findReplace: false turns find off. documentStats: false turns word count off.
StarterKitOptionsStarterKit options deep-merged over the defaults.
useDocumentStatsWord count, character count, and reading time for the document and the selection.
DocumentStatsWords, characters, blocks, reading time, remaining room, and the selection.
UseDocumentStatsOptionsthrottleMs: update at most that often while typing.
DEFAULT_SHORTCUTSDefault key for every configurable command.
formatShortcutRenders a shortcut, with Mod as ⌘ or Ctrl.
BlockcnCommandIdId of a command in DEFAULT_SHORTCUTS.
ShortcutBindingA key, a list of keys, or false to disable a command.
ShortcutsOptionPartial shortcut map accepted by createEditorExtensions.
acceptSlashItemRuns a slash item, unless onSlashSelect cancels it.
BlockChangeA block that was inserted or deleted.
BlockcnHookOptionsLifecycle hooks passed to createEditorExtensions.
BlockMoveA block that moved, with its old and new position.
DropInfoA drop the editor is about to handle.
PasteInfoA paste the editor is about to handle.
BlockErrorHandlerCalled when a React node view throws. The node stays in the document.
BlockA block read back by editor.blocks, keyed by type.
BlockApieditor.blocks: read and edit blocks by id.
BlockInputA block to insert. text is its plain text.
BlockPlacementbefore, after, or nested inside a toggle or column.
BlockPropsMapProps the core schema stores on each block type.
defineBlockcnNodeNode.create that stores storage.blockcn flags.
defineAddonStores extensions, slash entries, chrome, and serializers on one add-on.
BlockcnAddonOne add-on: extensions, slash, chrome, and serializers.
BLOCKCN_SCHEMA_VERSIONSchema version stored on a document and used by migrations.
ContentErrorInfoWhat onContentError receives when loaded JSON is still invalid.
DocumentMigrationRewrites a stored document before the schema check.
defaultMessagesEnglish copy for every editor string.
mergeMessagesDeep-merges a partial locale over the English defaults.
formatMessageFills {name} placeholders in a message.
MessagesThe full message catalog.
PartialMessagesA deep partial of Messages, for a locale override.
useMessagesThe merged messages for the surrounding Editor.
getMessagesMessages for an editor instance, including outside React.
I18nHolds the message catalog on the editor.
JSONContentTiptap's JSON document. What getJSON and renderDocument take.

editor-shell

ExportSummary
EditorReact root: frame, content, chrome, and outline.
FindReplacePanelFind and replace panel. Editor.Frame mounts it.
useEditorCreates the editor and reports local document changes.
DEFAULT_EDITOR_CONTENTStarter document with one example of each block and inline mark.
isLocalDocChangeWhether a transaction changed the document locally.
ChangeOptionsOptions for the debounced document callback on useEditor.
UseEditorOptionsuseEditor options: Tiptap's options plus onChange.
useAutosaveSaves after edits settle, and again on hide or unmount.
AutosaveStatusidle, dirty, saving, saved, or error.
UseAutosaveOptionsDebounce and flush options for useAutosave.
UseAutosaveResultStatus, last save time, error, and flush from useAutosave.
createBlockcnEditorCore blocks plus the add-ons you pass. Tables come from table().

editor-vanilla

ExportSummary
mountBlockcnEditorMounts the core editor with a DOM toolbar and slash menu. No React.
MountBlockcnEditorOptionsContent, messages, and the change callback for mountBlockcnEditor.
MountedEditorThe editor mountBlockcnEditor returns, plus destroy.

media-blocks

ExportSummary
mediaImage, video, audio, file, and link add-on.
mediaExtensionsMedia extensions with no upload function.
createMediaExtensionsMedia extensions with your upload options.
MediaExtensionsOptionsUpload limits, accept list, and uploadFile for media.
MediaUploadDrop target and upload progress for media files.
createUploadFileBrowser upload to endpoint, with optional bearer headers.
UploadFileFnFunction the media blocks call to store a file.
UploadFileOptionsProgress and abort signal passed into an upload.
UploadFileResultURL and optional metadata returned by an upload.
MEDIA_SLASH_CATEGORYSlash category id for the media blocks.
MediaToolbarsFloating toolbars for image, video, audio, file, and link.

excalidraw-block

ExportSummary
excalidrawWhiteboard add-on.
ExcalidrawOptionsOptions for the whiteboard add-on.
excalidrawExtensionsWhiteboard extensions used when you are not going through the preset.
createExcalidrawExtensionsWhiteboard extensions with your options.
excalidrawThemeResolves the whiteboard theme from the editor theme.
EXCALIDRAW_SLASH_CATEGORYSlash category id for the whiteboard block.

table-toolbar

ExportSummary
tableTable add-on, including the row and column toolbar.
TableOptionsOptions for the table add-on.
tableExtensionsTable extensions used when you are not going through the preset.
createTableExtensionsTable extensions with your options.
tableCellBackgroundsNamed background colours a cell can use.
TABLE_SLASH_CATEGORYSlash category id for the table block.
TableToolbarFloating row and column toolbar. Not in the default preset since the row and column grips replaced it.
TableHandleMenuMenu opened by a table's row and column grips: colour, insert, duplicate, clear, delete, and header toggles.

export-menu

ExportSummary
ExportMenuMenu that previews a Markdown, HTML, Word, or pasted import, then downloads HTML, Markdown, or Word, or prints a PDF.
renderDocumentHTML for a stored document. No DOM and no React.
exportRegistryOfThe serializer map stored on one editor.
DrawingCollectorTurns a drawing scene into a PNG data URL while exporting.
ExportRegistryDataSerializers and drawing collector stored for one editor.
ExportDocPreparerRewrites the document before an export serializes it.
NodeSerializerHTML function for one node type.
SerializerMapNode type to HTML serializer.

ai-menu

ExportSummary
aiAsk AI add-on. transport wins over endpoint.
AiOptionsOptions for the Ask AI add-on.
plainTextTransportReads a text response as one chunk.
sseTransportReads text/event-stream chunks.
aiSdkTransportAdapts a Vercel AI SDK stream.
AskAIErrorError thrown by a transport and shown in the panel.
AskAIContextDocument text around the selection, sent with a request.
AskAIRequestOne Ask AI request: action, selection, and instruction.
AskAITransportYields completion chunks and stops when signal aborts.
HttpTransportOptionsHeaders and URL options for the plain-text transport.
SseTransportOptionsHeaders and URL options for the SSE transport.
collectAskAIContextCollects title and nearby block text for an Ask AI request.
AskAIContextOptionsHow much surrounding text collectAskAIContext includes.

columns

ExportSummary
columnsResizable column layout add-on.
ColumnsOptionsOptions for the columns add-on.
columnsExtensionsColumn extensions used when you are not going through the preset.
createColumnsExtensionsColumn extensions with your options.
COLUMNS_SLASH_CATEGORYSlash category id for the columns block.

math

ExportSummary
mathKaTeX block and inline math add-on.
MathOptionsOptions for the math add-on.
mathExtensionsMath extensions used when you are not going through the preset.
createMathExtensionsMath extensions with your KaTeX options.
MATH_SLASH_CATEGORYSlash category id for the math block.

mentions

ExportSummary
emojiCustom emoji data and recents for the : list and the callout grid.
EmojiOptionsOptions for emoji().
mentions@ mentions and the : emoji list.
MentionOptionsOptions for the mentions add-on. fetchMentions is required.
createMentionExtensionsMention extensions. fetchMentions is required.
mentionExtensionsMention extensions with an empty suggestion list.
mentionSlashCategorySlash category for inserting a mention.
MENTION_SLASH_CATEGORYDefault slash category id for mentions.
mentionLabelLabel shown for a mention suggestion.
mentionColorStable swatch for a person's id.
MentionColorPalette name assigned to a mention.
FetchMentionsLoads mention suggestions for the text after @.
MentionExtensionsOptionsOptions for createMentionExtensions.
MentionItemOne suggestion: id and label.

toc

ExportSummary
tocTable-of-contents block add-on.
TocOptionsOptions for the table-of-contents add-on.
tocExtensionsContents extensions used when you are not going through the preset.
createTocExtensionsContents extensions with your heading levels.
TOC_SLASH_CATEGORYSlash category id for the contents block.

comments

ExportSummary
commentsComment threads anchored to text, with the composer and thread popover.
CommentsAddonOptionscomments() options, plus chrome: false to mount the popover yourself.
createCommentExtensionsThe comment mark, its plugin, and the export hook, without the preset.
createMemoryCommentStoreThreads kept in memory; onChange hands them to you to save.
createYjsCommentStoreThreads in a Y.Map on a collaboration document.
createCommentThreadAnchors a new thread on a range with its first comment.
replyToThreadAdds a reply as the current user.
editCommentChanges the text of one of your comments.
deleteCommentDeletes one of your comments; the last one takes the thread with it.
deleteThreadDeletes a thread and removes its highlight.
resolveThreadMarks a thread resolved and hides its highlight.
reopenThreadOpens a resolved thread again.
canCommentWhether the current user may add, reply to, and resolve comments.
commentsOfThe comments add-on's store and options on an editor, or null.
commentFootnotesComment marks as numbered footnotes plus a list at the end.
stripCommentMarksThe document with every comment mark removed.
commentPlainTextA comment body with mention tokens as @Label.
threadIdsInDocThread ids anchored in a document, in order.
threadRangeFirst and last position of a thread's anchor.
CommentsOptionsOptions for createCommentExtensions.
CommentAuthorWho wrote a comment.
CommentEntryOne comment in a thread.
CommentThreadA thread: status, quote, and comments.
CommentThreadStatusopen or resolved.
CommentStoreStorage interface for threads.
CommentMentionItemA person offered after @ in a comment.
FetchCommentMentionsLoads people for @ in a comment.
MemoryCommentStoreOptionsOptions for createMemoryCommentStore.
CommentFootnotesOptionsOptions for commentFootnotes.
YDocLikeThe Y.Doc methods the Yjs store uses.
YMapLikeThe Y.Map methods the Yjs store uses.
CommentsLayerComposer for a new comment and the open thread's popover.
CommentsSidebarEvery anchored thread, open or resolved; works read-only.
useCommentThreadsEvery thread in the editor's store, for your own UI.

versions

ExportSummary
versionsVersion history add-on. Pass chrome: false to mount HistoryPanel yourself.
VersionsAddonOptionsversions() options, plus chrome: false to mount the panel yourself.
DEFAULT_VERSION_INTERVAL_MSHow often a versions editor snapshots a changed document.
createMemoryVersionStoreVersions kept in memory.
createServerVersionStorageVersions on the example server. checkout requires a write token.
createVersionExtensionsThe versions extension without the history panel.
diffDocumentsInsertions and deletions between two documents.
versionsOfThe versions add-on on an editor, or null.
DiffPartOne step of a text diff.
VersionsOptionsOptions for createVersionExtensions.
VersionStorageWhere versions are stored.
VersionRecordA saved version and its snapshot.
VersionMetaA saved version without its snapshot.
VersionAuthorSomeone recorded on a version.
HistoryPanelThe history panel: list, preview, diff, name, and restore.

suggestions

ExportSummary
suggestionsSuggestion mode. Pass chrome: false to mount SuggestionModeToggle yourself.
SuggestionsAddonOptionssuggestions() options, plus chrome: false to mount the toggle yourself.
SuggestionModeToggleThe editing, suggesting, and viewing toggle.
SuggestionCardsSuggestion cards. The comments sidebar mounts these when both add-ons are installed.
createSuggestionExtensionsExtensions for suggestion mode without the toggle.
suggestionsOfThe suggestions add-on on an editor, or null.
suggestionModeThe current editing, suggesting, or viewing mode.
suggestionItemsSuggestions in document order.
SuggestionAuthorSomeone a suggestion is attributed to.
SuggestionModeediting, suggesting, or viewing.
SuggestionItemOne suggestion, as the sidebar lists it.
SuggestionsOptionsOptions for createSuggestionExtensions.
ExportSummary
linkPreviewPaste menu for a lone URL. The app fetches metadata.
LinkPreviewOptionsOptions for linkPreview().

pages

ExportSummary
pagesPage links. The app owns the page tree, search, and routing.
PagesOptionsOptions for pages(). fetchPages is required.

On this page