/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type { DOMConversionMap, DOMExportOutput, EditorConfig, LexicalEditor, LexicalNode, NodeKey, SerializedEditor, SerializedLexicalNode, Spread } from 'lexical'; import { DecoratorNode } from 'lexical'; import { type JSX } from 'react'; import type { ImageSizeMode } from '../../types'; export interface ImagePayload { file?: File; altText: string; caption?: LexicalEditor; height?: number; key?: NodeKey; maxWidth?: number; showCaption?: boolean; src?: string; width?: number; captionsEnabled?: boolean; markerState?: string; frame?: string; sizeMode?: ImageSizeMode; } export type SerializedImageNode = Spread<{ altText: string; caption: SerializedEditor; height?: number; maxWidth: number; showCaption: boolean; src?: string; width?: number; markerState?: string; frame?: string; sizeMode?: ImageSizeMode; type: 'image'; version: 1; }, SerializedLexicalNode>; export declare class ImageNode extends DecoratorNode { file?: File; __src?: string; __altText: string; __width: 'inherit' | number; __height: 'inherit' | number; __maxWidth: number; __showCaption: boolean; __caption: LexicalEditor; __markerState?: string; __frame?: string; __sizeMode?: ImageSizeMode; __captionsEnabled: boolean; static getType(): string; static clone(node: ImageNode): ImageNode; static importJSON(serializedNode: SerializedImageNode): ImageNode; exportDOM(): DOMExportOutput; static importDOM(): DOMConversionMap | null; constructor(src: string | undefined, altText: string, maxWidth: number, width?: 'inherit' | number, height?: 'inherit' | number, showCaption?: boolean, caption?: LexicalEditor, captionsEnabled?: boolean, key?: NodeKey, file?: File, markerState?: string, frame?: string, sizeMode?: ImageSizeMode); exportJSON(): SerializedImageNode; setWidthAndHeight(width: 'inherit' | number, height: 'inherit' | number): void; setShowCaption(showCaption: boolean): void; setMarkerState(markerState: string): void; setFrame(frame?: string): void; setSizeMode(sizeMode?: ImageSizeMode): void; createDOM(config: EditorConfig): HTMLElement; updateDOM(): false; getSrc(): string | undefined; setSrc(src: string): void; getAltText(): string; decorate(): JSX.Element; } export declare function $createImageNode({ altText, height, maxWidth, captionsEnabled, src, width, showCaption, caption, key, file, markerState, frame, sizeMode, }: ImagePayload): ImageNode; export declare function $isImageNode(node: LexicalNode | null | undefined): node is ImageNode;