UNPKG

2.02 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 image/imagetextalternative/imagetextalternativeui
7 */
8import { Plugin } from 'ckeditor5/src/core';
9import { ContextualBalloon } from 'ckeditor5/src/ui';
10/**
11 * The image text alternative UI plugin.
12 *
13 * The plugin uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.
14 */
15export default class ImageTextAlternativeUI extends Plugin {
16 /**
17 * The contextual balloon plugin instance.
18 */
19 private _balloon?;
20 /**
21 * A form containing a textarea and buttons, used to change the `alt` text value.
22 */
23 private _form?;
24 /**
25 * @inheritDoc
26 */
27 static get requires(): readonly [typeof ContextualBalloon];
28 /**
29 * @inheritDoc
30 */
31 static get pluginName(): "ImageTextAlternativeUI";
32 /**
33 * @inheritDoc
34 */
35 init(): void;
36 /**
37 * @inheritDoc
38 */
39 destroy(): void;
40 /**
41 * Creates a button showing the balloon panel for changing the image text alternative and
42 * registers it in the editor {@link module:ui/componentfactory~ComponentFactory ComponentFactory}.
43 */
44 private _createButton;
45 /**
46 * Creates the {@link module:image/imagetextalternative/ui/textalternativeformview~TextAlternativeFormView}
47 * form.
48 */
49 private _createForm;
50 /**
51 * Shows the {@link #_form} in the {@link #_balloon}.
52 */
53 private _showForm;
54 /**
55 * Removes the {@link #_form} from the {@link #_balloon}.
56 *
57 * @param focusEditable Controls whether the editing view is focused afterwards.
58 */
59 private _hideForm;
60 /**
61 * Returns `true` when the {@link #_form} is the visible view in the {@link #_balloon}.
62 */
63 private get _isVisible();
64 /**
65 * Returns `true` when the {@link #_form} is in the {@link #_balloon}.
66 */
67 private get _isInBalloon();
68}