Référence de l'API
Cette référence est générée depuis les sources. Rien n'y figure sans commentaire de documentation : la couverture cesse d'être un dénominateur, et vous lisez cent pour cent de ce qui a été documenté délibérément plutôt qu'une fraction de ce qui se trouve exporté.
La référence décrit ; les guides expliquent. Quand une entrée demande un concept, elle renvoie au guide au lieu de le refaire — c'est cette couture qui empêche les deux de diverger.
@nbe/core
The headless editor: block store, seven invertible operations, transactions, selection, history and commands. Zero DOM.
| Nom | Genre | Description |
|---|---|---|
ancestors | fonction | Bounded parentId walk; returns the ancestor chain (nearest first). |
anchoredThreads | fonction | Every thread id anchored anywhere in the document, and where. |
applyAutoformat | fonction | Apply an autoformat rule: strip the prefix and convert the block. |
applyDividerAutoformat | fonction | '---' becomes a divider with a fresh paragraph after it. |
applyInlineFormat | fonction | Strip the delimiters and mark what they enclosed. Deleting only the delimiters (rather than replacing the span) keeps marks already inside the content, so `**a *b* c**` ends bold with the italic intact. |
applyMark | fonction | Add or remove a mark over [from, to). A mark of the same type is replaced, unless the type stacks — see @nbe/core!MarkSpec.multiple. |
applyOp | fonction | Apply one operation to the document. |
applyTextReplacement | fonction | Swap the sequence for its character, keeping the marks it was typed under so an arrow inside a bold run stays bold. One dispatch, so one `⌘Z` puts the literal text back. |
applyView | fonction | Pure view evaluation: filters (AND) then stable multi-sort. |
at | fonction | Tag a contribution with a precedence. |
BlockCategory | type | Three kinds of block, and every behavioural question follows from which one you have: - `text` carries inline content, so it owns a caret and is edited - `void` has no text (image, divider, page link, database): there is no caret to place, so a press on it is a grab, not an edit - `layout` is structure (columns, page): never a drag target of its own |
BlockPlugin | interface | A block plugin: one declaration covering every surface a block touches. `schema` is JSON-serializable and free of behaviour on purpose — the static renderer and a future Swift port consume it without executing any JavaScript. Everything else is behaviour and lives beside it rather than inside it. |
BlockSpec | interface | The declarative description of a block type. |
BlockStore | interface | Where a document's blocks live. |
byPrecedence | fonction | Sort contributions by category, then by the order they were registered in. |
CommentMessage | interface | One message in a thread. |
COMPUTED_TYPES | constante | Property types whose value is derived, never authored. |
computeRow | fonction | Resolve a row's derived properties (formula, rollup). Authored values pass through untouched. Formulas may reference other formulas; a cycle resolves to null instead of hanging — one bad formula must never take a table down. |
DatabaseData | interface | What a database view needs from its host. |
deleteBackward | fonction | Delete the selected range, or one perceived character backward. |
deleteTextSelection | fonction | Delete a text selection, including one spanning several blocks: the tail of the first block and the head of the last are removed, blocks fully inside disappear, and the remainder of the last block merges into the first — exactly what a user expects from pressing Backspace over a selection. |
docFromJSON | fonction | Build a document from stored JSON, migrating it when given a schema. |
documentOrder | fonction | Every block id in reading order — depth-first from the root. |
Editor | classe | The document, its schema, its selection, and the only way to change any of them. |
evaluateExpr | fonction | Evaluate an AST. Never throws — invalid operations produce null. |
evaluateFormula | fonction | Parse + evaluate in one call. Parse errors yield null (use parseFormula to surface them). |
evaluateView | fonction | Filters + sorts + optional grouping in one call (what views actually need). Derived properties are resolved FIRST so formulas and rollups can be filtered, sorted and grouped on like any other column. |
expandsForward | fonction | True when typing *after* this mark should continue it. |
formatValue | fonction | Human formatting of a cell value for read-only display. |
formulaDependencies | fonction | Property names a formula reads — the dependency edges for cycle detection. |
FormulaValue | type | Formula language (AQ#8): a small, total, pure expression evaluator. Design rules, all deliberate: - no I/O, no clock, no randomness — a formula is a pure function of the row, so results are reproducible, cacheable, and safe to recompute anywhere (browser, CLI, future native client) - never throws at evaluation time: bad input yields `null`, so one broken formula can never take a table down. Parse errors ARE reported, because they are authoring feedback. - properties are referenced by name via prop("Name"), which keeps formulas readable and lets the schema rename them without touching ids |
GRAPHEME_AWARE | constante | True when this engine can segment properly rather than by surrogate pair. |
graphemeBoundaries | fonction | Cluster boundaries within `text`, as offsets, including 0 and `length`. |
graphemeLength | fonction | How many perceived characters `text` contains. |
groupRows | fonction | Group rows by a property. Group order follows the property's declared options (so board columns keep the schema order), then any ad-hoc values, with the no-value group last. A multi-select row appears in every group it belongs to — the Notion board behavior. |
hasMark | fonction | True if the entire [from, to) range carries a mark of this type. |
indent | fonction | Tab: nest the block under its previous sibling (Notion indent). |
insertColumns | fonction | A column layout, asked for rather than dragged into being. |
insertParagraphAfter | fonction | Put an empty paragraph right after a block, and the caret in it. |
insertText | fonction | Insert a plain-text run at the caret, replacing any selected range first. |
lossy | fonction | Declare that a format cannot represent this block faithfully. |
MarkdownProjection | interface | How a block becomes markdown and comes back. Both directions are required, and that is the point. A plugin author who only implements `toMarkdown` has written a block that silently degrades on re-import; the type refuses it. When a format genuinely cannot represent a block, say so with lossy rather than omitting the handler. |
markExpansion | fonction | How a mark expands, defaulting to `after`. |
MarkExpansion | type | Which side of a mark absorbs text typed against it. - `after` — typing at the end continues the mark. What emphasis should do. - `before` — typing at the start continues it. - `both` — either edge. - `none` — the mark keeps exactly the characters it was applied to. |
MARKS | constante | The closed mark set of §2.2, with its edge behaviour. |
marksAt | fonction | Marks the next typed character should carry. |
matchAutoformat | fonction | The rule for what was typed, or null. |
matchInlineFormat | fonction | Inline markdown span ending exactly at the caret, or null. |
matchTextReplacement | fonction | The replacement ending exactly at the caret, or null. |
memoryComments | fonction | A store held in memory. |
mergeBackward | fonction | Backspace-at-start semantics: non-paragraph converts to paragraph first (Notion behavior), then paragraph merges into the previous inline block. |
mergeForward | fonction | Delete-at-end semantics: pull the next visible block into this one. A void next block (divider, image) gets block-selected instead of destroyed. |
migrateBlock | fonction | Bring one block up to the schema's current version. |
migrateJSON | fonction | Migrate a whole document tree, depth-first. |
Migration | type | Upgrades a block by exactly one version. |
moveBlocks | fonction | Move blocks to an explicit position (drag & drop before/after). |
moveBlocksVertical | fonction | Move a contiguous group of sibling blocks one slot up or down. |
moveIntoColumns | fonction | Drop blocks on the left/right edge of a target (ARCHITECTURE §7): wraps the target in a column_list, or adds a column when the target is already one. |
needsAttention | fonction | True when the report contains anything a caller should act on. |
newMessage | fonction | Build a message, filling in the parts a caller should not have to. |
newThread | fonction | Build a thread from its first message. |
nextGrapheme | fonction | The offset one perceived character after `offset`. |
nextWord | fonction | Where a forward word-delete should stop, from `offset`. |
normalizeRuns | fonction | Merge adjacent runs with identical mark sets, drop empty runs. |
Op | type | The closed operation set (ARCHITECTURE §3). Every mutation flows through these. Applying an op returns its exact inverse ops. |
orphanThreads | fonction | Threads whose text is gone. |
outdent | fonction | Shift+Tab: move the block after its parent, one level up. |
parseFormula | fonction | Parse a formula source into an AST. Throws FormulaError on bad syntax. |
PluginRegistry | classe | Per-editor, never module-global. ProseMirror's module-level `PluginKey` produces a long-running class of failure — "Adding different instances of a keyed plugin" — whenever two copies of a package load, and our own `block-actions.ts` and `block-toolbar.ts` are the same mistake in miniature: two editors on one page share their registries today. Module-level *keys* are fine; module-level *values* are not. |
PluginVersionError | classe | Thrown when a plugin declares a contract version this build cannot honour. |
Point | interface | A position in inline text: (blockId, UTF-16 offset). Never persisted. |
Precedence | type | Where a contribution sits relative to others of its kind. Named categories, not numbers, and this is the single most evidence-backed decision in the plugin design. A module in isolation cannot know what numbers other modules picked — they are points on an undifferentiated range, i.e. z-index. Lexical shipped five numeric buckets, found you could not get in front of a listener at your own level, and had to add negative constants that bit-mask back into the same bucket. Tiptap shipped its ordering backwards for a long time and nobody noticed, because the resulting order is unobservable. Within a category, registration order decides. That is observable in the array the host wrote. |
prevGrapheme | fonction | The offset one perceived character before `offset`. |
prevWord | fonction | Where a backward word-delete should stop, from `offset`. |
PropertyType | type | Database model (ARCHITECTURE §2.5, phase 3): the four record kinds. - the `database` BLOCK (schema.ts) is the placement in a page (view block) - CollectionSchema (typed properties) and ViewConfig (layout/filter/sort) are workspace-level records owned by the host - rows are ordinary pages whose props carry { collectionId, properties } This module is the pure evaluation engine; rendering lives in @nbe/dom and storage in the host. Formulas, relations and rollups are evaluated here: `computeRow` resolves them before any filter, sort or grouping runs, so a computed column behaves like any other (AQ#8). |
rangeHasMark | fonction | True when every covered stretch of the range carries the mark. |
rangeInBlock | fonction | The covered [from, to) inside one block of a resolved range. |
Ranked | interface | A value with a precedence attached. `at()` is how you tag one. |
registerMark | fonction | Register or override a mark's edge behaviour, for a plugin's own mark. |
relationIds | fonction | Relation values are stored as an array of related page ids. |
report | fonction | Apply the configured reaction to a set of violations. |
resolveTextRange | fonction | Put a text selection into document order and enumerate the inline blocks it covers. Everything that acts on a range (delete, format, copy) works from this, so cross-block behaviour is defined in exactly one place. |
selectedBlocks | fonction | Resolve a block selection to its top-level selected blocks: the blocks in the visible range whose ancestors are not themselves selected (a selected block always implies its whole subtree). |
setColumnCount | fonction | Add or remove columns, keeping what was written in them. |
setColumnRatios | fonction | How the width is shared out: one `ratio` per column, as `flex-grow`. |
singleBlockRange | fonction | The selected range when it lies in a single block, in document order and snapped off any character it would bisect. |
snapGrapheme | fonction | Move an offset onto the nearest cluster boundary. |
spanExit | fonction | Where the caret has to go to get *out* of the span it is inside. |
splitBlock | fonction | Enter semantics (ProseMirror-inspired chain, ARCHITECTURE §3): empty non-paragraph → turn into paragraph; else split at the caret. |
TEXT_REPLACEMENTS | constante | The pairs, longest first — `endsWith` takes the first hit, so `-->` has to be tried before `->` or the arrow eats the second dash. |
threadIdsIn | fonction | The thread ids a block's text is marked with. |
threadsInDocumentOrder | fonction | Threads in the order their anchors appear down the page. |
toggleChecked | fonction | Tick or untick every to-do among `ids`. |
toggleMark | fonction | Toggle a mark over the current text selection (single block for now). |
toggleMarkRange | fonction | Toggle a mark over a range, across blocks when the selection spans them. |
validateBlock | fonction | Check one block against its spec. |
validateDoc | fonction | Check every block in a document. |
ValidationMode | type | How a violation is surfaced. |
Violation | interface | Per-block validation at apply. |
visibleBlocks | fonction | Depth-first order of visible blocks (collapsed toggles hide their children). |
visibleProperties | fonction | Properties shown in a view, in schema order, honoring `hidden`. |
@nbe/dom
The single contenteditable view: rendering, keymaps, clipboard, drag, overlays and the UI primitives.
| Nom | Genre | Description |
|---|---|---|
attachTooltip | fonction | Attach a tooltip to an element. Each target owns its tooltip node rather than sharing one module-level element: with a shared node, one control hiding its tooltip removes the node another control just showed, so tooltips flicker or never appear at all. The node is also dropped when the target leaves the DOM, and *that* is the hard half. A tooltip hides on `mouseleave` — but **an element removed from the document never fires one**, and the chrome this is attached to is removed all the time: the gutter hides when the pointer leaves a block, a toolbar rebuilds, a menu closes. So the pointer moves away, the button vanishes, no event arrives, and the label sits there pointing at nothing (reported 2026-08-10, with a screenshot of « Commenter ce bloc » alone in the margin). Checking `isConnected` at show time was already here and could not catch it: by then the tooltip is up, and the removal happens afterwards. So while one is on screen — one at a time, and rarely — a frame loop watches for the target going away. Cheap, and it needs no further gesture from the user, which a "hide on the next pointermove" fix would. |
autoUpdate | fonction | Keep a floating element glued to a live anchor across scroll, viewport resize, anchor movement AND its own content changing size. That last one is what makes filtering menus behave: a menu placed above its anchor is positioned from its own height, so when the list shrinks to one item the box must move back DOWN or it visibly floats away from what it is attached to. A ResizeObserver on the floating element catches every such change — content edits, images loading, fonts swapping — without the caller having to remember to reposition. |
blockClickRecognizer | constante | Notion-style routing: pressing anywhere on a block's row — its padding, its gutter, the empty area right of short text — places the caret at the nearest text position instead of silently doing nothing, which used to leave the model selection stale so later keystrokes landed at the old spot. |
BlockKeyHandler | type | Return true when the key was handled; the keymap then stops. |
BlockRenderContext | interface | The editing-surface half of a block plugin. `BlockPlugin.view` is typed `unknown` in core, because core must never depend on the DOM; this is where it is refined. A plugin package therefore splits by entry point — the schema entry depends on `core`, the `/dom` entry on `dom` — which is what §9 of the architecture always anticipated and what keeps the markdown and static-renderer packages free of DOM. Everything here replaces a closed dispatch that exists today: | contribution | replaces | |---|---| | `render` | a whole-block branch of `render.ts` | | `chrome` | a row-decorating case of `render.ts`'s switch | | `actions` | `block-actions.ts`'s module-global registry | | `toolbar` | `block-toolbar.ts`'s module-global registry | | `slash` | an entry of `slash.ts`'s `ITEMS` array | | `turnInto` | an entry of `block-types.ts`'s `TURN_INTO` | | `keys` | a branch of `keymap.ts` | | `features` | an `attach*` hardwired into the default feature list | | `styles` | a slice of `style/blocks.css` | |
blockToolbarFeature | constante | The per-block toolbar shown on hover. |
builtinBlocks | constante | No built-in block plugins ship from `@nbe/dom`. Deliberately empty rather than a barrel of everything: Tiptap's `StarterKit` statically imports about twenty extensions, so `configure({ heading: false })` turns a block off and leaves its code in the bundle. Ergonomics and tree-shaking are in direct conflict there and the kit wins. A host composes the array it wants: ```ts import { callout } from '@nbe/blocks-callout/dom' new EditorView(el, editor, { blocks: [callout] }) ``` The block types still built into the view's switch are not plugins yet; they need no registration. |
canPaintCrossBlock | fonction | True when this browser can paint a cross-block selection. |
caretLine | fonction | Whether the caret is on the block's first or last *visual* line. |
classicFeatures | constante | The older kind of editor: a page of text with a toolbar, no block chrome. |
clipboardFeature | constante | Copy, cut and the full paste pipeline. |
closeAllOverlays | fonction | Close everything. Used when an editor is destroyed under an open overlay. |
CommentAuthor | interface | A person, for display beside what they said. |
CommentContext | interface | What a comment affordance was pointing at. |
commentMarkersFeature | constante | A commented block says so in the right margin, without being hovered. |
CommentThreadOptions | interface | |
computePosition | fonction | Pure positioning: viewport-relative coordinates for a floating element. Flips to the opposite side when the preferred side overflows and the other side fits; always clamps inside the viewport padding. (Micro floating-ui — ponytail: no shift/arrow middleware until a real need appears.) |
createActionButton | fonction | The one way to build an action control in this editor. Every surface (block gutter, block toolbar, selection toolbar, link card, database chrome, block-rendered affordances) goes through here, so tooltip, accessible name, popover-toggle behaviour and selection preservation are decided once instead of being remembered at ~40 call sites. |
createDragGhost | fonction | A drag preview that follows the pointer: clones of what is being dragged, stacked, with a count badge when several items travel together. In-house because native HTML5 drag images cannot be styled or updated (decision D8) — this is the piece that makes dragging feel physical, and it is shared by block drag and board-card drag. |
createDropZone | fonction | Empty-media placeholder: click to choose, drop to fill, or paste a URL. Returns the element; the caller owns placement. |
createHoverZone | fonction | Hover controller for block chrome. Fixes the classic hover loss: listens on document (not the content element), resolves targets by geometry so the left margin still hovers the adjacent block, keeps the target while the pointer is over the floating chrome, and hides only after a grace delay. |
createSegmented | fonction | A small set of mutually exclusive choices, shown at once. A select hides its options behind a click; for two to four visual choices — text alignment, a callout variant — showing them is both faster and self-documenting. |
crossBlockHighlightFeature | constante | Paints a text selection that spans blocks, which the browser will not hold. |
databaseFeature | constante | Interactive database views. Needs a `database` host to do anything. |
debugHolding | fonction | True while the chrome is pinned. Cheap enough for a hover path. |
DEFAULT_ALIGN | constante | Where a media block sits when nobody has said. |
defaultExportFormats | constante | The three formats this package can produce on its own. |
defaultFeatures | constante | Everything that makes the editor feel like the demo. |
defaultLabels | constante | The labels an editor uses when a host names none. |
defaultLeftGutter | constante | The + button and the ⋮⋮ handle, in that order. |
defaultRecognizers | constante | Precedence, most specific first. This list is the arbitration story. |
defaultRightGutter | constante | Just the comment button, and only when `onComment` is set. |
dismissedBy | fonction | True when the press that just closed an overlay happened inside `trigger`. A trigger button must TOGGLE its overlay: without this, pressing it again dismisses (outside press) and the click that follows immediately reopens, which reads as a broken button. Trigger handlers call this and bail. Still time-bounded, because it genuinely is about one press-then-click pair rather than about state — but the window only has to outlive a single browser-generated click, not a user gesture. |
documentSize | fonction | Count the document as a reader sees it: visible blocks, plain text. |
DomBlockPlugin | interface | A plugin whose `view` has been refined to this layer's type. |
domToModelPoint | fonction | Map a DOM position to a (blockId, offset) model point. |
draggable | fonction | Pointer-based drag session (in-house by decision D8 — see docs/research/hard-interactions.md). Robustness rules learned the hard way: - move/up/cancel listen on `window`, not the handle: if the handle is hidden, re-rendered or detached mid-drag, the session still ends. - pointer capture is attempted as an extra (it keeps events flowing when the pointer leaves the window) but is never relied upon. - the session also ends on Escape, pointercancel, window blur, and a second pointer going down — a drag can never be left dangling. - callbacks are exception-safe: a throw in onMove/onDrop still runs the caller's cancel path instead of freezing the page in drag state. |
dragMechanics | fonction | The two things a router-owned drag still needs: a movement threshold and edge auto-scroll. Everything else `draggable()` does — window-level listeners, Escape, blur, pointercancel, exception safety, teardown — the gesture router already provides, so a recognizer must not re-implement it. This is the shared remainder, extracted rather than copied. |
EditableTopology | interface | Where the editable boundary is — the one thing that separates "one contenteditable per block" (D1) from "a single editable root". The insight that makes this cheap: today's code conflates two different elements under the name "leaf". - the **leaf** is the element whose text maps 1:1 to a block's model text. It exists in both topologies, and every selection primitive needs it to answer "which block, which offset". - the **host** is the element carrying `contenteditable`. It is what the browser will and will not drag-select across. Per-block, they are the same element. Single-host, the leaf is a plain div and the host is the content root. Once they are separate names, every interaction module can be written against the host without caring which topology it is running under — and the question the cross-block selection driver actually asks, *"will the browser natively span these two?"*, reduces to `hostOf(a) === hostOf(b)`. |
editInline | fonction | Replace an element's content with a text field, commit on Enter or blur, restore on Escape. The inline-edit pattern `database.ts` hand-rolled for cells and titles. |
EditorFeature | interface | A feature is anything that attaches behaviour to a mounted view and can be removed again. |
EditorView | classe | A document, projected into the DOM, and everything that makes editing it feel like an editor. |
EditorViewOptions | interface | Everything a host can change when mounting an editor. |
EmojiEntry | type | An emoji and what it is called, one string per language. |
ESCAPE_SELF_ATTR | constante | A control inside an overlay that needs Escape for itself — cancelling an edit rather than closing the overlay — marks itself with this attribute. The stack listens in the capture phase on purpose: an open overlay must beat the editor's keymap, or Escape would drop out of text mode behind an open menu. Capture means nothing deeper ever gets a chance, so the one legitimate exception has to be declared rather than discovered. |
exportFeature | constante | `⌘P` offers Markdown, plain text and print-to-PDF. Not in `defaultFeatures`. |
ExportFormat | interface | Take the page with you: `⌘P` offers the formats this document can become. |
FieldOptions | interface | The form layer of the UI primitives. It exists because the two per-block-type registries that will become the plugin API — `block-actions.ts` and `block-toolbar.ts` — already hand-roll their inputs, and `database.ts` hand-rolls ten of them. A block author with nothing to reach for writes raw DOM, and raw DOM then *is* the contract. Three rules every control here obeys, so no call site has to remember them: 1. **Escape belongs to the control.** A field inside a menu must cancel its own edit rather than close the menu, so everything here carries `data-nbe-escape-self` and the overlay stack yields to it. 2. **Keys stay inside.** Editor keymaps listen on the content and menus navigate with arrows; a field that lets its keydown bubble gets its text interpreted as commands. Everything here stops propagation. 3. **Commit is explicit.** Enter commits, Escape reverts, blur commits — once. Comparing against the last committed value is what separates "commit on blur" from "commit twice when Enter also blurs". |
findFeature | constante | `⌘F` finds in the page. **Not in defaultFeatures**, deliberately: in a browser that key is the browser's, and replacing it with something worse is one of the things this project's competitors are resented for. Add it in a host that has no browser find to take — a plugin pane, a desktop shell. |
findHits | fonction | Every occurrence of `query` in the visible document, in reading order. |
findScrollParent | fonction | Nearest scrollable ancestor (falls back to the document scroller). |
FollowControl | interface | Following someone: the viewport goes where they go. |
format | fonction | Fill `{name}` placeholders in a label. |
formatToolbarFeature | constante | The floating format toolbar shown over a text selection. |
gesturesFeature | constante | Pointer arbitration: text selection, block click-routing, the rubber band. |
GutterAction | interface | One button in a hover gutter. |
gutterFeature | constante | The hover gutter: the + button, the ⋮⋮ handle, its menu, and drag & drop. |
GutterItem | type | An entry in a gutter: one of the editor's own buttons, by name, or your own. |
icon | fonction | Build an inline SVG icon element. Unknown names render nothing visible. |
inputFeature | constante | Reading and writing text: beforeinput, composition, the DOM reconciler. |
insertBlocksAt | fonction | Put blocks where the caret is — the insertion half of paste and drop. |
isMod | fonction | True when the event carries this platform's command modifier. |
keymapFeature | constante | Keyboard commands and navigation. |
labelsFor | fonction | The pack for a code, English for anything else. |
leafOf | fonction | The element whose text maps 1:1 to a block's model text, in any topology. |
linkHoverFeature | constante | The hover card on a link, for editing or opening it. |
LinkPasteOptions | interface | What a link should become, asked at the moment it arrives. |
LOCALE_NAMES | constante | For a picker: the code and the language's name in itself. |
LOCALES | constante | The languages that ship. |
loneLink | fonction | The same offer, for a link that is already in the document. |
MENTION_MARK | constante | Inline page mentions: `@` opens a picker, choosing inserts a live reference. |
MentionCandidate | interface | A page the host offers for `@` completion. |
mentionRuns | fonction | The runs a chosen mention becomes: the reference, then a trailing space. |
mentionsFeature | constante | `@` opens the page-mention picker. Inert without an `onSearchPages` host. |
MenuFilter | interface | The search field of a combobox: a menu you filter by typing. |
minimalFeatures | constante | The smallest editor that still edits: type, navigate, select, paste. |
nativeRangeSpans | fonction | Will the browser natively drag-select from `a` to `b`? Derived rather than implemented per topology: a drag-selection is constrained to the editing host it started in, so the answer is simply whether both ends share one. Per-block that is false across blocks, which is why the cross-block driver exists; single-host it is always true, which switches that driver off without it needing to know why. |
offerLinkTreatments | fonction | Offer the treatments for a link that has just been pasted. |
openCommentThread | fonction | Open the discussion on a block. Wire it to `onComment`. |
openExport | fonction | Open the export menu on a mounted view, from outside the keyboard. |
openFind | fonction | Open the find bar on a mounted view, from outside the keyboard. |
openOverlays | fonction | Everything currently open, deepest last. Exposed for the Escape chain. |
openPagePicker | fonction | Point a `link_to_page` block at a page, found by searching the host. |
openPagePickerOn | fonction | The picker anchored to a block, for the slash menu and the ⋮⋮ menu alike. |
outsidePressFeature | constante | Drops a block selection when a press lands outside the editor. |
OverlayEntry | interface | The overlay stack: one place that owns "what is open, and what closes it". Before this, every overlay called `dismissable()` and attached its own capture-phase listeners. That made Escape a broadcast — a menu opened from inside a popover closed both — and made an outside-press decision that each overlay took alone, so a nested overlay dismissed its own parent. A stack answers both correctly and cheaply: - Escape closes the TOP entry and stops. - An outside press is judged against the whole stack, then closes every entry above the deepest one that contains the press. One document listener serves every overlay, regardless of how many are open. |
peerSelection | fonction | This editor's selection, flattened into what a peer needs to see. |
perBlockTopology | constante | D1 as shipped: every leaf is its own `plaintext-only` host. `plaintext-only` is the whole reason this topology is attractive — the browser refuses to inject markup, so the model stays the only source of structure. The fallback to `true` exists because Firefox only shipped `plaintext-only` recently; there the MutationObserver defence carries the weight instead. |
pickFile | fonction | File intake primitives shared by every block that accepts media. Kept dependency-free: a File becomes either a base64 data URL (works with zero host wiring) or an opaque asset ref when the host provides a store. |
PopoverOptions | interface | A floating panel with arbitrary content. `menu.ts` was doing two jobs: a keyboard-navigable list, and the generic "something floats next to this anchor" container. So every non-list overlay — the image drop zone, the formula editor, a property panel — had to pretend to be a menu item by passing `{ kind: 'custom', el }`. That is the escape hatch becoming the API, in miniature: a block plugin wanting a small form had no honest way to ask for one. A popover is the container without the list: positioning, the overlay stack, and nothing else. `createMenu` keeps the list behaviour and is now one *kind* of popover rather than the only floating thing that exists. |
positionFloating | fonction | Apply computePosition to a floating element already attached to <body>. |
PressContext | interface | One press, one owner. Five modules used to listen for pointerdown on the same surface and each decide, by sniffing the target, whether the press was theirs. Nothing arbitrated: precedence was whatever order `view.ts` happened to attach them in, and two could start on the same press. Worse, they coordinated through wall-clock windows — `textIntentActive()` at 500 ms, `justRubberBanded()` at 300 ms — because they had no shared notion of what was currently happening. Every one of those was a real bug fix, and every one was timing-fragile: a slow frame moved the boundary and the bug came back as an unreproducible flake. The router classifies a press once, hands it to exactly one recognizer, and publishes what is running. Modules ask about state instead of guessing from timestamps. |
pushOverlay | fonction | Push an overlay onto the stack. The returned function pops it — call it from the overlay's own close path, and it is safe to call twice. |
readOnlyFeatures | constante | Nothing attached: the document renders and never changes. |
refreshCommentMarkers | fonction | Repaint the markers — for a host whose counts live outside the document. |
RemotePeer | interface | A peer, as this package needs to see one. |
RemoteSelection | type | Where a peer is. |
removeCommentThread | fonction | Delete a thread and the anchor that pointed at it. |
requestFullscreen | fonction | Fill the screen with one element — the lightbox, spelled the platform's way. |
resizeHandles | fonction | Build the handles a resizable surface carries. |
resolveLabels | fonction | Merge a partial override over the defaults. |
reveal | fonction | Put an element on screen — and *only* when it is not already there. |
REVEAL_MARGIN | constante | Breathing room above a block scrolled to the top on purpose. |
rubberBandRecognizer | constante | Press on empty editor space and drag: top-level blocks intersecting the band's vertical range become a block selection. |
selectionSyncFeature | constante | Mirrors the browser selection into the model. |
shortcut | fonction | A shortcut, spelled the way this platform spells it. |
singleHostTopology | constante | The alternative D1 never got its spike against: one editable root. It buys native cross-block selection for free and costs a permanently editable container the browser will happily restructure — which is exactly the trade the roadmap wanted measured. Shipping it as a topology is what makes that measurement a config change rather than a rewrite. |
slashMenuFeature | constante | `/` opens the block menu. |
SlotName | type | Where chrome that is not a block may live. See EditorView.slot. |
stickyFormatToolbarFeature | constante | The same toolbar, pinned above the document instead — the older WYSIWYG shape, always visible. |
textSelectRecognizer | constante | Selecting text, including across blocks. Inside one editing host the browser does this natively and better than we would, so we stay out of the way entirely. Across hosts it will not: a `Selection` is clamped to the host the gesture started in, measured in Chromium 150 and 151 (`e2e/selection-topology.spec.ts`). `setBaseAndExtent` does not escape it, and neither does any temporary toggle of editability — the range dies the moment editability returns. So beyond that boundary the model carries the selection and the Highlight API paints it (`cross-block-highlight.ts`). That works because a plain `Range` spans hosts freely — only `Selection` is constrained — and because every range command already operates on the model rather than on the DOM. Under a single-host topology `nativeRangeSpans` stays true and none of this runs. |
toContainerPoint | fonction | Convert a viewport point into coordinates inside a positioned container. |
TriggerMenuOptions | interface | A menu opened by typing a character, filtered by what follows it. |
Typeface | interface | One of the faces a page can be set in. |
TYPEFACES | constante | The three that ship. The first is the default and needs no attribute. |
viewportGuardFeature | constante | Keeps the caret visible when a virtual keyboard opens over it. |
@nbe/markdown
The human-readable projection: markdown in both directions, plus CSV and Obsidian-shaped view files for collections. Depends on core only.
| Nom | Genre | Description |
|---|---|---|
APP_SECTION | constante | The key every piece of editor-owned data hangs under. |
blocksToMarkdown | fonction | Serialize blocks to markdown. |
documentToMarkdown | fonction | Write one back. |
emitScalar | fonction | A value as YAML: a plain scalar where that is unambiguous, JSON otherwise. |
Frontmatter | classe | The frontmatter of one file: a small ordered map that remembers its source. |
FrontmatterSplit | interface | A file's frontmatter and the Markdown under it. |
MarkdownDocument | interface | A Markdown file as this editor sees it: what the document *is*, and what it is *about*. |
MarkdownOptions | interface | Options carried through a whole serialization or parse. |
markdownToBlocks | fonction | Parse markdown into blocks. |
markdownToDocument | fonction | Read a Markdown file: its frontmatter, then its blocks. |
parseScalar | fonction | A YAML scalar, as the value it means. |
readFrontmatter | fonction | Split a Markdown file into its frontmatter and its prose. |
runsToMarkdown | fonction | Serialize rich text. |
slugify | fonction | A title reduced to what a filename and a wikilink target can both hold. |
unknownMarker | fonction | The line an unregistered block type is written as: `<!-- nbe:type {…} -->`. |
unquote | fonction | Take the quotes off a YAML string, keeping what is inside them. |
writeFrontmatter | fonction | Put a file back together. |
@nbe/static-renderer
JSON to HTML without an editor instance and without DOM globals — for export, server rendering and static sites.
| Nom | Genre | Description |
|---|---|---|
renderBlocksToHTML | fonction | Render a list of sibling blocks to an HTML fragment. |
RenderOptions | interface | Static HTML rendering: schema JSON → HTML with no editor instance and no DOM APIs (SSR/CLI safe). Depends on @nbe/core only — never on @nbe/dom (ARCHITECTURE §9). Markdown projection lives in @nbe/markdown. |
renderToHTML | fonction | Render a page (root block) to an HTML fragment. |
renderToText | fonction | Plain text extraction (search indexes, previews, meta descriptions). |