Interface describing a widget table of contents model.

interface IModel<H extends TableOfContents.IHeading> {
    activeHeading: null | H;
    activeHeadingChanged: ISignal<TableOfContents.IModel<H>, null | H>;
    collapseChanged: ISignal<TableOfContents.IModel<H>, null | H>;
    configuration: TableOfContents.IConfig;
    documentType: string;
    headings: H[];
    headingsChanged: ISignal<TableOfContents.IModel<H>, void>;
    isActive: boolean;
    isDisposed: boolean;
    stateChanged: ISignal<TableOfContents.IModel<H>, void>;
    supportedOptions: (keyof TableOfContents.IConfig)[];
    title?: string;
    toggleCollapse: (options: { collapsed?: boolean; heading?: H }) => void;
    dispose(): void;
    setActiveHeading(heading: null | H, emitSignal?: boolean): void;
    setConfiguration(c: Partial<TableOfContents.IConfig>): void;
}

Type Parameters

Hierarchy (View Summary)

Implemented by

Properties

activeHeading: null | H

Active heading

activeHeadingChanged: ISignal<TableOfContents.IModel<H>, null | H>

Signal emitted when the active heading changes.

collapseChanged: ISignal<TableOfContents.IModel<H>, null | H>

Signal emitted when a table of content section collapse state changes.

If all headings state are set at the same time, the argument is null.

configuration: TableOfContents.IConfig

Model configuration

documentType: string

Type of document supported by the model.

A data-document-type attribute with this value will be set on the tree view .jp-TableOfContents-content[data-document-type="..."]

headings: H[]

Returns the list of headings.

list of headings

headingsChanged: ISignal<TableOfContents.IModel<H>, void>

Signal emitted when the headings changes.

isActive: boolean

Whether the model needs to be kept up to date or not.

This is set to true if the ToC panel is visible and to false if it is hidden. But some models may require to be always active; e.g. to add numbering in the document.

isDisposed: boolean

Test whether the object has been disposed.

This property is always safe to access.

stateChanged: ISignal<TableOfContents.IModel<H>, void>

A signal emitted when any model state changes.

supportedOptions: (keyof TableOfContents.IConfig)[]

List of configuration options supported by the model.

title?: string

Document title

toggleCollapse: (options: { collapsed?: boolean; heading?: H }) => void

Callback on heading collapse.

Methods

  • Dispose of the resources held by the object.

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

  • Set a new active heading.

    Parameters

    • heading: null | H

      The new active heading

    • OptionalemitSignal: boolean

      Whether to emit the activeHeadingChanged signal or not.

    Returns void