@univerjs/docs-toc
Table-of-contents commands for Univer Docs. Register this model plugin after the Docs core plugins; add @univerjs/docs-toc-ui for the editor controls.
TypeScript
import { UniverDocsTocPlugin } from '@univerjs/docs-toc'univer.registerPlugin(UniverDocsTocPlugin)Commands
Call commands through univerAPI.executeCommand() after opening a document and placing a text selection.
| Export | Parameters |
|---|---|
InsertTableOfContentsCommand | Optional unitId, levels, showPageNumbers, rightAlignPageNumbers, tabLeader, format, and title. |
UpdateTableOfContentsCommand | Optional unitId, rangeId, and mode: 'pageNumbersOnly' | 'entireTable'. |
DeleteTableOfContentsCommand | Optional unitId and rangeId. |
The root also exports their parameter types, TableOfContentsFormat, TableOfContentsTabLeader, and findTableOfContentsAtOffset.
The updater evaluates outline-level TOC instructions (\o). Other Word switches remain in FIELD metadata but are not all evaluated. The inserted TOC is document content; the outline navigation panel is a separate feature.
This package has no stylesheet, locales, or Facade entry. See the table-of-contents guide.
How is this guide?