Skip to Content
API Referencereferences-react

@stesura/references-react

React UI for footnotes, endnotes and cross-references. Most hosts only need referenceUiExtensions; the individual pieces are exported for hosts that build their own toolbar or layout.

See the references guide for how the feature behaves.

referenceUiExtensions

The whole feature as one UI extension: toolbar groups (References and View tabs), the cross-reference panel, context menu and preview, the anchor node views, and both note panels in the document overlay.

import { referenceUiExtensions } from '@stesura/references-react' <StesuraEditor uiExtensions={[referenceUiExtensions]} />
NameTypeDefault
leftPanelsLeftPanelElement[]
rightPanelsRightPanelElement[]
bottomPanelsBottomPanelElement[]
contextMenuExtensionsContextMenuExtension[]
textMenuExtensionsTextMenuExtension<string>[]
toolbarDefaultTabsPartial<Record<ToolbarDefaultTabs, false>>
toolbarDefaultExtensionsToolbarDefaultExtension[]
toolbarGroupExtensionsToolbarGroupExtension[]
floatingMenuExtensionsFloatingMenuExtension[]
slashMenuExtensionsMenuElement[]
StatusBarElementsStatusBarElement[]
nodeViewsNodeViews
nodeViewWrappersRecord<string, ComponentType<NodeViewWrapperComponentProps>>

DOM-less wrappers composed around whichever view wins for a node type. A wrapper must render {children} (the wrapped view) and add no DOM; it contributes via context, typically NodeViewSlotsProvider. Unlike a nodeViews entry, it survives the consumer’s nodeViews overrides.

pdfPreviewPdfPreviewCapability

Renders PDF file nodes as page previews (@stesura/pdf-viewer-react). Declared on the extension rather than set from an effect so the file view, pagination and export know it before the first layout; an effect arrives a commit late and forced a second pagination pass.

documentOverlaySlotReact.ReactNode
ResizableLayoutBottomSlotReact.ReactNode
TopLeftSlotReact.ReactNode
CommentsSlotReact.ReactNode

Toolbar groups

For hand-built toolbars. Each renders a ready-made group of buttons; the buttons themselves stay internal.

ExportContents
FootnotesGroupInsert footnote, previous/next, open the panel
EndnotesGroupInsert endnote, previous/next, open the panel
CrossReferenceGroupOpen the cross-reference panel
OpenFootnotesGroupOpen the footnote panel (View tab)
OpenEndnotesGroupOpen the endnote panel (View tab)

Note panels

FootnotePanel and EndnotePanel take no props. Each renders the panel for its kind, plus the listener that opens it on a search match inside a note. Render them inside the editor (they read its context); they position themselves at the bottom of the nearest positioned ancestor.

referenceNodeViews

The footnote and endnote anchor node views, keyed by node name. Without them anchors fall back to the schema’s toDOM: they show their number but don’t open the panel.

Not exported separately

The cross-reference panel, its context-menu entries and the Ctrl/⌘ preview are only available through referenceUiExtensions.

Last updated on