noteloom

API reference

The full surface is on the package root — import { ... } from 'noteloom'. Heavy optional features also have their own entry so an unused one leaves your bundle: noteloom/collab, noteloom/persistence, noteloom/comments, noteloom/versions, noteloom/voice, noteloom/canvas, noteloom/starter-kit, noteloom/theme. This page groups exports by concern.

Simplified API

useEditorOne-call editor setup — { doc?, history?, currentUserId?, extensions?, registerBlocks?, registerInlineTypes? } in, { store, registry, inlineRegistry, extensions, toJSON } out. doc accepts the simple format or the internal graph (auto-detected); toJSON({ format }) reads it back — 'simple' (default) or 'internal'. 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.
addPerson / updatePerson / removePerson / usePeopleSince 0.3.3. A document-level, collaboration-aware people list — real synced document data (same tier as comment threads), not device-local storage, so every collaborator sees and can manage the same list. Meant as the options source for an "Assignee"-style createSelectFieldType — see Custom select field types.

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.

Extensions

defineBlock / defineInlineValidating factories for a block or inline type. Return a plain registry entry tagged with name + kind. See Custom blocks & extensions.
defineExtensionA named unit for the extensions array — bundles blocks/inlineTypes and/or behavior (keymap, onBeforeInput, onPaste, setup(ctx)).
registerExtensionsRegisters a flat/nested array of the above onto a pair of registries — the primitive behind useEditor({ extensions }).
starterKitstarterKit({ exclude? }) — every built-in type as an array. Also on noteloom/starter-kit.
smartQuotes / autoPairBracketsReady-made behavior extensions — the useSmartQuotes / useAutoPairBrackets hooks in extensions form.

Registries

createBlockRegistry / BlockRegistryBlock-type registry.
createInlineRegistry / InlineRegistryInline (run) type registry.
registerBuiltInBlocks / registerBlocksRegister every built-in block, or just the ones you name. Deprecated — prefer extensions + starterKit().
registerBuiltInInlineTypes / registerInlineTypesSame idea, for inline types. Deprecated.
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. Since 0.3.3: uploadFile/maxFileSize (see Embed) and showLineNumbers (see Code).
useFileUploadSince 0.3.3. Reads { uploadFile, maxFileSize } back off context — for building your own upload UI outside EmbedBlock. See Embed.
injectDefaultStylesInjects the default theme <style> tag. EditorProvider calls it automatically today, with a one-time dev warning — that auto-injection is deprecated, so call this yourself (or import 'noteloom/theme'), or pass theme="none".
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 / importDocumentSimpleJSON / isSimpleDocumentThe canonical self-contained JSON format (also what editor.toJSON() returns) and its shape detector — schema at document.schema.json. 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.
useTouchOnlyDeviceSince 0.6.0. A static, one-time device classification (boolean) — deliberately not live-updated like useCoarsePointer, since this is for a decision that shouldn't flip mid-session (e.g. whether "/" opens the slash menu at all). True only on a device with no non-touch pointer, so a touchscreen laptop still reads false.
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. Since 0.3.3, an engine option lets you supply your own recognition backend for embedded webviews (Tauri, Electron) where the browser API is absent or broken — see Embedded webviews. Since 0.6.0, a store option lets you call it outside an EditorProvider (needed for the FloatingToolbar/NoteloomEditor voice prop below).

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. Since 0.6.0, an optional voice prop (pass what useVoiceTyping({ store })returns) adds a dictation toggle to it — see Voice typing. Omit it and no voice-typing code enters your bundle.
useEditorKeyboardShortcutsWires every built-in keyboard shortcut — see Keyboard shortcuts.
useSmartQuotes / useAutoPairBracketsSince 0.3.3. Opt-in typing-behavior hooks, mounted the same way as the trigger hooks above ((containerRef, { enabled? })): curly-quote substitution, and auto-closing/ skipping/wrapping brackets. Both no-op inside code blocks.

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.