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
useEditor | One-call editor setup — { doc?, history?, registerBlocks?, registerInlineTypes? } in, { store, registry, inlineRegistry } out. See Getting started. |
NoteloomEditor | Renders 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 / listPersistedDocumentIds | The 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
CollabSession | Real-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.getTombstoneCount | The lower-level EditorStore/History methods createPeriodicTombstoneGC wraps. |
Store & history
EditorStore | The normalized document store — getBlock, getRun, applyOperation, subscribe, toJSON, EditorStore.fromJSON. |
History | Wraps a store with undo/redo + an audit log. Same read/write surface as EditorStore. |
operations | Namespace of every low-level store operation (insertBlock, updateRun, …) — for advanced/custom command authoring. |
Registries
createBlockRegistry / BlockRegistry | Block-type registry. |
createInlineRegistry / InlineRegistry | Inline (run) type registry. |
registerBuiltInBlocks / registerBlocks | Register every built-in block, or just the ones you name. |
registerBuiltInInlineTypes / registerInlineTypes | Same idea, for inline types. |
TABLE_BLOCKS / LAYOUT_BLOCKS / TABLE_SELECT_INLINE_TYPES | Pre-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, canvasBlockType | Individual block-type entries for opt-in registration — see Blocks. |
selectInlineType, dateInlineType, checkboxInlineType, tableSelectInlineType, emojiInlineType | Individual inline-type entries — see Inline types. |
React bindings
EditorProvider | Context 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. |
injectDefaultStyles | The function EditorProvider calls internally to inject the default theme — exported in case you need to trigger it manually outside the provider's own effect. |
useBlockClassName | Reads the current getBlockClassName from context — used internally by every block component, exposed for custom/third-party blocks that want the same behavior. |
useEditorStore / useBlockRegistry / useInlineRegistry | Read the provider's values. |
useBlock / useRun | Subscribe to one block/run by id. |
useFieldTypes | Subscribe to the document's persisted custom field types. |
useHistory | Subscribe to undo/redo availability. |
useBlockChildren | Subscribe to a container block's ordered child ids. |
useWholeDocumentSelection / useBlockRangeSelection / useSelectedBlock | Selection state used by keyboard shortcuts, clipboard, and the block-range action menu. |
usePreviewMode | Toggle a read-only preview rendering mode. |
BlockRenderer / BlockChildren / BlockErrorBoundary | Rendering primitives — BlockChildren is what you mount for a container's content. |
BlockGutterRow / BlockRangeActionMenu / useBlockRangeDrag | Drag-to-select-a-range-of-blocks affordance and its action menu (duplicate/move/delete/copy a range). |
EditableBlockContent | The shared contentEditable primitive every text-bearing block renders into. |
Modal / Select | Small unstyled-logic UI primitives reused across block editing popovers. Modal takes an optional size="large" for wider dialogs (used by DocumentExportButton). |
EditorTrailingSpace | Ensures there's always a clickable area past the last block. |
Clipboard
useClipboardHandlers | Returns onCopy/onCut/onPaste for your container. |
APP_MIME | The custom clipboard MIME type used for lossless same-editor round-trips. |
serializeBlockRange / remapSubtreeIds / deserializeClipboard | Lower-level serialize/deserialize primitives. |
walkDomToBlocks / textToParagraphs | Foreign-HTML and plain-text paste conversion. |
copyBlockRangeToClipboard | Programmatic "copy this block range" primitive. |
exportDocumentJSON / exportDocumentHTML / exportDocumentText | Whole-document export to a string — see Exporting documents. |
exportDocumentSimpleJSON / importDocumentSimpleJSON | The simplified, self-contained JSON interchange format — see Exporting documents. |
DocumentExportButton | Drop-in "View source" button + modal wrapping the export functions above. |
Mobile & voice
MobileActionBar | Touch-first equivalent of the desktop block gutter/floating toolbar — see Mobile & voice typing. |
MobileBlockPickerSheet / MobileBlockOptionsSheet | The individual bottom-sheet pickers MobileActionBar opens — exported in case you want to build your own trigger for them. |
useCoarsePointer | Reactive "is touch input happening right now" signal, live-updated per pointerdown, not just a static media query. |
useVirtualKeyboardInset | Tracks the on-screen keyboard's height via visualViewport, so your own UI can sit above it. |
useVoiceTyping | Continuous dictation + spoken structural commands via the browser's Web Speech API. |
Commands & menus
SlashMenu | Generic filterable command popover — reused for "/", "@", and ":" (pass distinct menuId/ariaLabel per instance). |
useSlashMenuTrigger / useAtMenuTrigger / useEmojiMenuTrigger | Watch for "/"/"@"/":" and resolve matching commands. |
FloatingToolbar / useFloatingToolbarTrigger | The Notion/TipTap-style format bar shown above a text selection. |
useEditorKeyboardShortcuts | Wires every built-in keyboard shortcut — see Keyboard shortcuts. |
Marks & selection
toggleMarkOnRunRange / toggleMarkOverSelection / toggleMarkOverBlockRange | Toggle a boolean mark (bold/italic/…) over a selection. |
setMarksOverSelection / setMarksOverBlockRange | Set arbitrary mark values (color, highlight) over a selection. |
getMarksSummaryOverSelection / getMarksSummaryOverBlockRange | Read which marks are active across a selection (for toolbar state). |
deleteRunRangeInBlock / deleteOverBlockRange / deleteEntireDocument | Selection-aware delete primitives. |
resolveRunSelection / resolveMultiRunSelection / resolveCrossBlockSelection / resolveCollapsedCaret | Map the native browser selection onto the document model. |
isEntireBlockSelected | Whether a block's entire content is currently selected. |
focusRunEnd / focusRunStart / focusRunAtOffset | Imperatively move the caret. |
Block & document helpers
ensureRootNonEmpty | Guarantees the document always has at least one leaf block to type into. |
duplicateBlock / moveBlockUp / moveBlockDown / deleteBlockAndFocusSibling | Single-block actions (used by each block's own action menu). |
deleteBlockRange / moveBlockRangeUp / moveBlockRangeDown / isEntireBlockRangeHidden / setBlockRangeHidden / reorderBlockRangeFromStore | Multi-block range actions. |
Table helpers
insertRowAfter / deleteRow / insertColumnAfter / deleteColumn | Structural table edits. |
renameColumn / setColumnType / setColumnOptions / setColumnWidth | Column metadata edits. |
resolveColumns / createDefaultColumns / createCellForColumn / convertRunToType / blankRunForType | Lower-level column/cell primitives. |
COLUMN_TYPES / DEFAULT_COLUMN_TYPE / DEFAULT_COLUMN_WIDTH / MIN_COLUMN_WIDTH | Table column constants. |
TableHeaderRow | The table's column-header row component. |
Custom field types
createSelectFieldType | Build a full inline type from a config object — see Custom select field types. |
registerStoredFieldTypes | Rehydrate a document's persisted custom field types into an inline registry. |
useRegisterFieldTypes | Reactive React-hook wrapper around the above. |
FieldTypeEditorModal / useFieldTypeEditor | The in-editor "create/manage a field type" UI. |