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 image/imagecaption/imagecaptionutils
|
7 | */
|
8 | import type { DocumentSelection, Element, Selection, ViewElement, Match } from 'ckeditor5/src/engine';
|
9 | import { Plugin } from 'ckeditor5/src/core';
|
10 | import ImageUtils from '../imageutils';
|
11 | /**
|
12 | * The image caption utilities plugin.
|
13 | */
|
14 | export default class ImageCaptionUtils extends Plugin {
|
15 | /**
|
16 | * @inheritDoc
|
17 | */
|
18 | static get pluginName(): "ImageCaptionUtils";
|
19 | /**
|
20 | * @inheritDoc
|
21 | */
|
22 | static get requires(): readonly [typeof ImageUtils];
|
23 | /**
|
24 | * Returns the caption model element from a given image element. Returns `null` if no caption is found.
|
25 | */
|
26 | getCaptionFromImageModelElement(imageModelElement: Element): Element | null;
|
27 | /**
|
28 | * Returns the caption model element for a model selection. Returns `null` if the selection has no caption element ancestor.
|
29 | */
|
30 | getCaptionFromModelSelection(selection: Selection | DocumentSelection): Element | null;
|
31 | /**
|
32 | * {@link module:engine/view/matcher~Matcher} pattern. Checks if a given element is a `<figcaption>` element that is placed
|
33 | * inside the image `<figure>` element.
|
34 | * @returns Returns the object accepted by {@link module:engine/view/matcher~Matcher} or `null` if the element
|
35 | * cannot be matched.
|
36 | */
|
37 | matchImageCaptionViewElement(element: ViewElement): Match | null;
|
38 | }
|