import { GeneralOptions } from '../../types'; export * from './components/RichTextImage'; export interface ImageUploadResult { /** The unique identifier returned by the backend for this image. */ imageId?: string | null; /** The CDN URL of the uploaded image. */ cdnUrl: string; } export type ImageSource = 'upload' | 'link' | 'unsplash'; export interface ImageAttribution { provider: string; authorName?: string | null; authorUrl?: string | null; sourceName?: string | null; sourceUrl?: string | null; } export interface ImageUnsplashPhoto { id: string; width?: number; height?: number; color?: string | null; blurHash?: string | null; description?: string | null; altDescription?: string | null; urls: { raw?: string; full?: string; regular?: string; small?: string; thumb?: string; cover?: string; [key: string]: string | undefined; }; links?: { html?: string; downloadLocation?: string | null; [key: string]: string | null | undefined; }; user: { name: string; username?: string; htmlUrl?: string; [key: string]: unknown; }; [key: string]: unknown; } export interface ImageUnsplashSearchParams { query: string; page: number; perPage: number; orientation?: 'landscape' | 'portrait' | 'squarish'; } export interface ImageUnsplashSearchResponse { photos: ImageUnsplashPhoto[]; total?: number; totalPages?: number; } export interface ImageUnsplashInsertResult { imageId?: string | null; src?: string; alt?: string | null; attribution?: ImageAttribution | null; } export interface ImageUnsplashOptions { search: (params: ImageUnsplashSearchParams) => Promise; /** * Optional consumer hook for persisting/proxying a selected Unsplash photo * before it is inserted. Secrets and server calls stay in the consuming app. */ select?: (photo: ImageUnsplashPhoto) => Promise; /** * Optional consumer hook for registering the Unsplash download after insert. * Omit this when `select` already handles download tracking server-side. */ trackDownload?: (photo: ImageUnsplashPhoto) => Promise; perPage?: number; orientation?: 'landscape' | 'portrait' | 'squarish'; initialQuery?: string; /** * Controls the legacy editable attribution paragraph insertion. When * renderAttributionInNode is enabled, attribution is rendered by the image * node view instead. */ insertAttribution?: boolean; getImageUrl?: (photo: ImageUnsplashPhoto) => string; getThumbnailUrl?: (photo: ImageUnsplashPhoto) => string; getAlt?: (photo: ImageUnsplashPhoto) => string; getAttribution?: (photo: ImageUnsplashPhoto) => ImageAttribution; formatAttributionText?: (attribution: ImageAttribution, photo: ImageUnsplashPhoto) => string; } export interface SetImageAttrsOptions { /** The unique identifier returned by the backend for this image. */ imageId?: string | null; src?: string; /** The alternative text for the image. */ alt?: string; /** The caption of the image. */ caption?: string; /** The width of the image. */ width?: number | string | null; /** The alignment of the image. */ align?: 'left' | 'center' | 'right'; /** Whether the image is inline. */ inline?: boolean; /** image FlipX */ flipX?: boolean; /** image FlipY */ flipY?: boolean; /** Whether the image is currently being uploaded (transient, not persisted). */ uploading?: boolean; attributionProvider?: string | null; attributionAuthorName?: string | null; attributionAuthorUrl?: string | null; attributionSourceName?: string | null; attributionSourceUrl?: string | null; } export declare function getImageDialogSources(options?: Partial): ImageSource[]; export declare function getDefaultUnsplashImageUrl(photo: ImageUnsplashPhoto): string; export declare function getDefaultUnsplashThumbnailUrl(photo: ImageUnsplashPhoto): string; export declare function getDefaultUnsplashAlt(photo: ImageUnsplashPhoto): string; export declare function getDefaultUnsplashAttribution(photo: ImageUnsplashPhoto): ImageAttribution; declare module '@tiptap/core' { interface Commands { imageUpload: { /** * Add an image */ setImageInline: (options: Partial) => ReturnType; /** * Insert a placeholder image that shows a skeleton while uploading. * Once the upload resolves, the placeholder is replaced with the real image. */ insertImagePlaceholder: (options: { file: File; inline?: boolean; alt?: string; }) => ReturnType; /** * Insert an Unsplash image and attach attribution metadata. */ insertUnsplashImage: (options: { photo: ImageUnsplashPhoto; image?: ImageUnsplashInsertResult | void; src?: string; imageId?: string | null; inline?: boolean; alt?: string; attribution?: ImageAttribution | null; insertAttribution?: boolean; }) => ReturnType; /** * Update an image */ updateImage: (options: Partial) => ReturnType; /** * Set image alignment */ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType; }; } } export interface IImageOptions extends GeneralOptions { /** Function for uploading files. Resolves with the backend response containing imageId and cdnUrl. */ upload?: (file: File) => Promise; HTMLAttributes?: any; multiple?: boolean; acceptMimes?: string[]; maxSize?: number; /** The source URL of the image */ resourceImage: 'upload' | 'link' | 'both' | 'unsplash'; /** * Render Unsplash attribution as a small, non-editable element attached to * the image node instead of inserting a normal paragraph into the document. */ renderAttributionInNode?: boolean; /** * Explicitly controls dialog tabs. Use ["upload", "unsplash"] to offer * only local upload and Unsplash search while keeping URL entry hidden. */ imageSources?: ImageSource[]; defaultInline?: boolean; unsplash?: ImageUnsplashOptions; enableAlt?: boolean; /** Function to handle errors during file validation */ onError?: (error: { type: 'size' | 'type' | 'upload'; message: string; file?: File; }) => void; } export declare const Image: import('@tiptap/core').Node;