noteloom

API reference

Every export lives at the package root — import { ... } from 'noteloom'. This page groups them by concern; see the relevant guide page for how each group is actually used.

Simplified API

useEditorOne-call editor setup — { doc?, history?, registerBlocks?, registerInlineTypes? } in, { store, registry, inlineRegistry } out. See Getting started.
NoteloomEditorRenders an editor from useEditor() — clipboard, slash/emoji/@-mention menus, floating toolbar, keyboard shortcuts, and block-range drag all pre-wired. Props: editor, className, style, theme, getBlockClassName, children — see Getting started.

Offline persistence

usePersistedDocument{ store, docId, debounceMs?, onError? }{ isLoaded }. Loads a saved document into store on mount, then auto-saves every change back to IndexedDB, debounced. See Offline persistence.
savePersistedDocument / loadPersistedDocument / deletePersistedDocument / listPersistedDocumentIdsThe raw IndexedDB operations usePersistedDocument is built on — for a non-React host, custom load/save timing, or listing saved documents (e.g. a "My Notes" index page).
createAutoPersistence{ store, docId, debounceMs?, onError? }{ stop, flush }. Just the debounced auto-save half, if you handle the initial load yourself.
useServiceWorkerUpdate() => { updateAvailable, applyUpdate }. Watches for a waiting service worker and lets you activate it — the one reusable piece of an offline app-shell/PWA setup.

Live collaboration

CollabSessionReal-time multi-peer editing over WebRTC via a custom block-tree CRDT. new CollabSession({ history, signaling, presenceThrottleMs? }); connect(remotePeerId, { initiator }), disconnect(remotePeerId), destroy(), setLocalPresence(data), getPresence(), onPresenceChange(cb). See Live collaboration.
createWebSocketSignaling{ url, roomId, peerId, WebSocketImpl? } → a SignalingChannel for real multi-device collaboration over a small relay (LAN or internet) — plus onPeerDiscovered(cb).
usePresence(session) => Map<peerId, data>, reactive — live cursors/awareness alongside the document sync.
createPeriodicTombstoneGC{ store, intervalMs?, maxAgeMs?, onPrune?, onError? }{ stop }. Opt-in periodic sweep of deleted-block/run tombstones — see Tombstone garbage collection.
store.pruneTombstones / store.getTombstoneCountThe lower-level EditorStore/History methods createPeriodicTombstoneGC wraps.

Store & history

EditorStoreThe normalized document store — getBlock, getRun, applyOperation, subscribe, toJSON, EditorStore.fromJSON.
HistoryWraps a store with undo/redo + an audit log. Same read/write surface as EditorStore.
operationsNamespace of every low-level store operation (insertBlock, updateRun, …) — for advanced/custom command authoring.

Registries

createBlockRegistry / BlockRegistryBlock-type registry.
createInlineRegistry / InlineRegistryInline (run) type registry.
registerBuiltInBlocks / registerBlocksRegister every built-in block, or just the ones you name.
registerBuiltInInlineTypes / registerInlineTypesSame idea, for inline types.
TABLE_BLOCKS / LAYOUT_BLOCKS / TABLE_SELECT_INLINE_TYPESPre-grouped bundles for block/inline types that only work together.
paragraphBlockType, headingBlockType, listItemBlockType, tableBlockType, tableRowBlockType, tableCellBlockType, layoutBlockType, layoutColumnBlockType, dividerBlockType, calloutBlockType, blockquoteBlockType, codeBlockType, toggleHeadingBlockType, buttonBlockType, embedBlockType, canvasBlockTypeIndividual block-type entries for opt-in registration — see Blocks.
selectInlineType, dateInlineType, checkboxInlineType, tableSelectInlineType, emojiInlineTypeIndividual inline-type entries — see Inline types.

React bindings

EditorProviderContext provider — { store, registry, inlineRegistry, history }, plus theme ('default' | 'none'), className/style (wrap children in one .be-root div), and getBlockClassName(block) for per-block class names — see Theming & styling.
injectDefaultStylesThe function EditorProvider calls internally to inject the default theme — exported in case you need to trigger it manually outside the provider's own effect.
useBlockClassNameReads the current getBlockClassName from context — used internally by every block component, exposed for custom/third-party blocks that want the same behavior.
useEditorStore / useBlockRegistry / useInlineRegistryRead the provider's values.
useBlock / useRunSubscribe to one block/run by id.
useFieldTypesSubscribe to the document's persisted custom field types.
useHistorySubscribe to undo/redo availability.
useBlockChildrenSubscribe to a container block's ordered child ids.
useWholeDocumentSelection / useBlockRangeSelection / useSelectedBlockSelection state used by keyboard shortcuts, clipboard, and the block-range action menu.
usePreviewModeToggle a read-only preview rendering mode.
BlockRenderer / BlockChildren / BlockErrorBoundaryRendering primitives — BlockChildren is what you mount for a container's content.
BlockGutterRow / BlockRangeActionMenu / useBlockRangeDragDrag-to-select-a-range-of-blocks affordance and its action menu (duplicate/move/delete/copy a range).
EditableBlockContentThe shared contentEditable primitive every text-bearing block renders into.
Modal / SelectSmall unstyled-logic UI primitives reused across block editing popovers. Modal takes an optional size="large" for wider dialogs (used by DocumentExportButton).
EditorTrailingSpaceEnsures there's always a clickable area past the last block.

Clipboard

useClipboardHandlersReturns onCopy/onCut/onPaste for your container.
APP_MIMEThe custom clipboard MIME type used for lossless same-editor round-trips.
serializeBlockRange / remapSubtreeIds / deserializeClipboardLower-level serialize/deserialize primitives.
walkDomToBlocks / textToParagraphsForeign-HTML and plain-text paste conversion.
copyBlockRangeToClipboardProgrammatic "copy this block range" primitive.
exportDocumentJSON / exportDocumentHTML / exportDocumentTextWhole-document export to a string — see Exporting documents.
exportDocumentSimpleJSON / importDocumentSimpleJSONThe simplified, self-contained JSON interchange format — see Exporting documents.
DocumentExportButtonDrop-in "View source" button + modal wrapping the export functions above.

Mobile & voice

MobileActionBarTouch-first equivalent of the desktop block gutter/floating toolbar — see Mobile & voice typing.
MobileBlockPickerSheet / MobileBlockOptionsSheetThe individual bottom-sheet pickers MobileActionBar opens — exported in case you want to build your own trigger for them.
useCoarsePointerReactive "is touch input happening right now" signal, live-updated per pointerdown, not just a static media query.
useVirtualKeyboardInsetTracks the on-screen keyboard's height via visualViewport, so your own UI can sit above it.
useVoiceTypingContinuous dictation + spoken structural commands via the browser's Web Speech API.

Commands & menus

SlashMenuGeneric filterable command popover — reused for "/", "@", and ":" (pass distinct menuId/ariaLabel per instance).
useSlashMenuTrigger / useAtMenuTrigger / useEmojiMenuTriggerWatch for "/"/"@"/":" and resolve matching commands.
FloatingToolbar / useFloatingToolbarTriggerThe Notion/TipTap-style format bar shown above a text selection.
useEditorKeyboardShortcutsWires every built-in keyboard shortcut — see Keyboard shortcuts.

Marks & selection

toggleMarkOnRunRange / toggleMarkOverSelection / toggleMarkOverBlockRangeToggle a boolean mark (bold/italic/…) over a selection.
setMarksOverSelection / setMarksOverBlockRangeSet arbitrary mark values (color, highlight) over a selection.
getMarksSummaryOverSelection / getMarksSummaryOverBlockRangeRead which marks are active across a selection (for toolbar state).
deleteRunRangeInBlock / deleteOverBlockRange / deleteEntireDocumentSelection-aware delete primitives.
resolveRunSelection / resolveMultiRunSelection / resolveCrossBlockSelection / resolveCollapsedCaretMap the native browser selection onto the document model.
isEntireBlockSelectedWhether a block's entire content is currently selected.
focusRunEnd / focusRunStart / focusRunAtOffsetImperatively move the caret.

Block & document helpers

ensureRootNonEmptyGuarantees the document always has at least one leaf block to type into.
duplicateBlock / moveBlockUp / moveBlockDown / deleteBlockAndFocusSiblingSingle-block actions (used by each block's own action menu).
deleteBlockRange / moveBlockRangeUp / moveBlockRangeDown / isEntireBlockRangeHidden / setBlockRangeHidden / reorderBlockRangeFromStoreMulti-block range actions.

Table helpers

insertRowAfter / deleteRow / insertColumnAfter / deleteColumnStructural table edits.
renameColumn / setColumnType / setColumnOptions / setColumnWidthColumn metadata edits.
resolveColumns / createDefaultColumns / createCellForColumn / convertRunToType / blankRunForTypeLower-level column/cell primitives.
COLUMN_TYPES / DEFAULT_COLUMN_TYPE / DEFAULT_COLUMN_WIDTH / MIN_COLUMN_WIDTHTable column constants.
TableHeaderRowThe table's column-header row component.

Custom field types

createSelectFieldTypeBuild a full inline type from a config object — see Custom select field types.
registerStoredFieldTypesRehydrate a document's persisted custom field types into an inline registry.
useRegisterFieldTypesReactive React-hook wrapper around the above.
FieldTypeEditorModal / useFieldTypeEditorThe in-editor "create/manage a field type" UI.