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
useEditor | One-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. |
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. |
addPerson / updatePerson / removePerson / usePeople | Since 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
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. |
Extensions
defineBlock / defineInline | Validating factories for a block or inline type. Return a plain registry entry tagged with name + kind. See Custom blocks & extensions. |
defineExtension | A named unit for the extensions array — bundles blocks/inlineTypes and/or behavior (keymap, onBeforeInput, onPaste, setup(ctx)). |
registerExtensions | Registers a flat/nested array of the above onto a pair of registries — the primitive behind useEditor({ extensions }). |
starterKit | starterKit({ exclude? }) — every built-in type as an array. Also on noteloom/starter-kit. |
smartQuotes / autoPairBrackets | Ready-made behavior extensions — the useSmartQuotes / useAutoPairBrackets hooks in extensions form. |
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. Deprecated — prefer extensions + starterKit(). |
registerBuiltInInlineTypes / registerInlineTypes | Same idea, for inline types. Deprecated. |
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. Since 0.3.3: uploadFile/maxFileSize (see Embed) and showLineNumbers (see Code). |
useFileUpload | Since 0.3.3. Reads { uploadFile, maxFileSize } back off context — for building your own upload UI outside EmbedBlock. See Embed. |
injectDefaultStyles | Injects 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". |
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 / isSimpleDocument | The canonical self-contained JSON format (also what editor.toJSON() returns) and its shape detector — schema at document.schema.json. 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. |
useTouchOnlyDevice | Since 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. |
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. 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
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. 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. |
useEditorKeyboardShortcuts | Wires every built-in keyboard shortcut — see Keyboard shortcuts. |
useSmartQuotes / useAutoPairBrackets | Since 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 / 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. |