UNPKG

1.89 kBTypeScriptView Raw
1/**
2 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4 */
5/**
6 * @module table/tablecaption/utils
7 */
8import type { DocumentFragment, DocumentSelection, Element, ViewElement } from 'ckeditor5/src/engine';
9/**
10 * Checks if the provided model element is a `table`.
11 *
12 * @param modelElement Element to check if it is a table.
13 */
14export declare function isTable(modelElement: Element | DocumentFragment | null): boolean;
15/**
16 * Returns the caption model element from a given table element. Returns `null` if no caption is found.
17 *
18 * @param tableModelElement Table element in which we will try to find a caption element.
19 */
20export declare function getCaptionFromTableModelElement(tableModelElement: Element): Element | null;
21/**
22 * Returns the caption model element for a model selection. Returns `null` if the selection has no caption element ancestor.
23 *
24 * @param selection The selection checked for caption presence.
25 */
26export declare function getCaptionFromModelSelection(selection: DocumentSelection): Element | null;
27/**
28 * {@link module:engine/view/matcher~Matcher} pattern. Checks if a given element is a caption.
29 *
30 * There are two possible forms of the valid caption:
31 * - A `<figcaption>` element inside a `<figure class="table">` element.
32 * - A `<caption>` inside a <table>.
33 *
34 * @returns Returns the object accepted by {@link module:engine/view/matcher~Matcher} or `null` if the element cannot be matched.
35 */
36export declare function matchTableCaptionViewElement(element: ViewElement): {
37 name: true;
38} | null;
39/**
40 * Depending on the position of the selection we either return the table under cursor or look for the table higher in the hierarchy.
41 */
42export declare function getSelectionAffectedTable(selection: DocumentSelection): Element;