/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module footnotes/footnotestracker * @publicApi */ import { Plugin, type Editor } from "@ckeditor/ckeditor5-core"; import type { ModelElement } from "@ckeditor/ckeditor5-engine"; /** * The footnotes tracker. It keeps track of all footnotes in the editor. * * It is used by the {@link module:footnotes/footnotesediting~FootnotesEditing} to update the list of * footnotes when they are added or removed. */ export declare class FootnotesTracker extends Plugin { /** * @inheritDoc */ static get pluginName(): "FootnotesTracker"; /** * @inheritDoc */ static override get isOfficialPlugin(): true; /** * @inheritDoc */ static override get isPremiumPlugin(): true; /** * @inheritDoc */ constructor(editor: Editor); /** * @inheritDoc */ init(): void; /** * Returns the footnotes definitions container element. * * @returns The footnotes definitions container or `null` if it does not exist. */ getFootnotesDefinitionsObjectElement(): ModelElement | null; /** * Returns the footnote with the given ID. * * @param footnoteId The ID of the footnote to find. * @returns The footnote item or `null` if not found. */ getFootnote(footnoteId: string): Footnote | null; /** * Returns all footnotes in the editor. * * @returns An array of footnote items. */ getFootnotes(): Array; /** * Returns the registered footnote formatter. * * @returns The footnote formatter or `null` if not set. */ getFootnotesFormatter(): FootnoteFormatterCallback | null; /** * Registers a custom footnote formatter. * * @param formatter The footnote formatter to register. */ setFootnoteFormatter(formatter: FootnoteFormatterCallback): void; } /** * Footnote item stored in the {@link module:footnotes/footnotestracker~FootnotesTracker}. */ export type Footnote = { id: string; reference: ModelElement; definition: ModelElement; }; /** * Parameters for formatting footnote list values. */ export type FormatFootnoteListValueParams = { /** * The footnote being formatted. */ footnote: Footnote; /** * The footnotes definitions container element. */ container: ModelElement; /** * Number of digits needed for the highest footnote number. */ digits: number; /** * The footnote number to format (1-based). */ value: number; }; /** * Footnote formatter interface. */ export type FootnoteFormatterCallback = (params: FormatFootnoteListValueParams) => string;