/*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net */ /** * [[include:plugins/image-caption/README.md]] * @packageDocumentation * @module plugins/image-caption */ import type { IJodit, Nullable } from "../../types/index"; import { Plugin } from "../../core/plugin/plugin"; import "./config"; /** * Captions images: wraps an image in `imageCaption`'s elements and back, and * keeps the caret in the caption */ export declare class imageCaption extends Plugin { /** @override */ protected afterInit(jodit: IJodit): void; /** * Gives `image` a caption, or takes it away, as `on` says, or else the * other way round from how it is. Returns the caption it gave, or null * when it took one away */ protected onToggleImageCaption(image: HTMLImageElement, on?: boolean): Nullable | void; /** * The caption given last, while nothing has changed round it and it's * still blank, so taking it off can put everything back as it was */ private __fresh; private __freshCaption; /** * Giving a caption isn't a step in the history of its own, as the first * thing typed in it is, so Undo never brings back a blank caption */ private __caption; /** * Changes the content with no step in the history of its own, so Undo * never brings back a blank caption. A step still open takes it in */ private __unrecorded; private __wrap; /** * Puts the image back as it was before its caption: in the line the * caption split, and with its own alignment, margins and width. The image * goes into the part of the line holding the caret, so the caret stays */ private __restore; private __uncaption; private __create; /** * Puts `wrapper` where `target` is. A block can't go in a paragraph, so the * paragraph is split round it, and a part left empty goes */ private __insert; /** * The wrapper can't be edited, apart from its caption, so typing can't * land between the image and the caption */ private __mark; private __placeholder; protected onChange(): void; /** * The placeholder goes with the first letter typed or pasted, and comes * back when the last is deleted */ protected onInput(): void; /** * The editor's own attributes stay out of the value, as the caption would * be editable on the page. So does a caption given and left blank, as * leaving it takes it off, so saving at once keeps the image as it was */ protected onAfterGetValueFromEditor(data: { value: string; }): void; protected onChangePlace(): void; private __press; private __afterPress; private __onMouseDown; /** * A caption left blank goes when the focus leaves it. That's checked once * the focus has landed, as switching windows or opening the editor's own * popups keeps it, and once a press that took the focus is over, as the * browsers fire no click when its target moves */ private __onFocusOut; private __onMouseUp; private __dropBlank; /** * The caption has the focus, or had it when another window took it, or * the editor's own popups and dialogs have it, as the link form */ private __keepsFocus; /** * The caption the caret is in */ private __caretCaption; /** * Enter in a caption starts a line after the image, and Shift+Enter * breaks the caption's line, as everywhere */ protected onBeforeEnter(event?: KeyboardEvent): false | void; /** * The caption keeps the focus, as an editable element of its own, and * would take the caret back, so the editor takes it before the caret * leaves the caption */ private __focusEditor; private __line; /** * A caption holds text. An image, a table or a block put in it would end * the captioned image, so it goes after the image, as Enter would */ protected onBeforeInsertNode(node: Node): void; private __arrow; /** * A selected captioned image goes as an image on a line of its own does, * leaving the line empty, rather than joining the lines either side */ protected onBeforeCommandDelete(): false | void; /** * The captioned image the selection holds, as a click on the image selects */ private __selectedWrapper; protected onKeyDown(event: KeyboardEvent): void; /** * An arrow key that couldn't move the caret in the caption takes it out, * past the image, as the caption is an editable element of its own */ protected onKeyUp(event: KeyboardEvent): void; protected onBeforeCommand(command: string): false | void; /** * Select all in a caption selects the caption, as the caption is an * editable element of its own */ private __onSelectAll; /** @override */ protected beforeDestruct(jodit: IJodit): void; }