Class TableOfContentsModel<H, T>Abstract

Abstract table of contents model.

Type Parameters

Hierarchy (view full)




_activeHeading: null | H
_activeHeadingChanged: Signal<TableOfContentsModel<H, T>, null | H>
_collapseChanged: Signal<TableOfContentsModel<H, T>, null | H>
_configuration: TableOfContents.IConfig
_headings: H[]
_headingsChanged: Signal<TableOfContentsModel<H, T>, void>
_isActive: boolean
_isRefreshing: boolean
_needsRefreshing: boolean
_title?: string
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="..."]

stateChanged: Signal<TableOfContentsModel<H, T>, void>

A signal emitted when any model state changes.

widget: T

The widget to search in


  • get isActive(): boolean
  • Whether the model is active or not.


    An active model means it is displayed in the table of contents. This can be used by subclass to limit updating the headings.

    Returns boolean

  • set isActive(v): void
  • 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.


    • v: boolean

    Returns void

  • get isAlwaysActive(): boolean
  • Whether the model gets updated even if the table of contents panel is hidden or not.


    For example, ToC models use to add title numbering will set this to true.

    Returns boolean

  • get isDisposed(): boolean
  • Test whether the model is disposed.

    Returns boolean


  • Test if two list of headings are equal or not.


    • headings1: H[]

      First list of headings

    • headings2: H[]

      Second list of headings

    Returns boolean

    Whether the array are equal.

  • Dispose the model.

    Returns void

  • Abstract function that will produce the headings for a document.

    Returns Promise<null | H[]>

    The list of new headings or null if nothing needs to be updated.

  • Test if two headings are equal or not.


    • heading1: H

      First heading

    • heading2: H

      Second heading

    Returns boolean

    Whether the headings are equal.

  • Set a new active heading.


    • heading: null | H

      The new active heading

    • emitSignal: boolean = true

      Whether to emit the activeHeadingChanged signal or not.

    Returns void

  • Callback on heading collapse.


    • options: {
          collapsed?: boolean;
          heading?: H;
      • Optional collapsed?: boolean

        The new collapsed status (toggle existing status if not provided)

      • Optional heading?: H

        The heading to change state (all headings if not provided)

    Returns void