import { Editor } from 'grapesjs'; import { CanvasScreenshotOptions as CanvasScreenshotOptionsSchema } from './typesSchema'; export interface CanvasScreenshotOptions extends Omit { /** * If this callback is provided, the screenshot will be taken automatically on each project save. * @example * screenshotOnSave: result => { * console.log('screenshotOnSave', result); * myUploadScreenshotFile(result.file); * } */ screenshotOnSave?: (props: ScreenshotResult) => void; } export interface ScreenshotElOptions { /** * Width in pixels to be applied to node before rendering. */ width?: number; /** * Height in pixels to be applied to node before rendering. */ height?: number; /** * Width of the canvas to be used for rendering. */ canvasWidth?: number; /** * Height of the canvas to be used for rendering. */ canvasHeight?: number; /** * A string indicating the image format. * @default 'image/png' */ type?: string; /** * A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). * A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range. */ quality?: number; /** * Additional screenshot library options. * @example * addOptions: (defaultOptions) => ({ * ...defaultOptions, * backgroundColor: '#fff', * }) */ addOptions?: (defaultOptions: Record) => Record; } export interface ScreenshotResult { editor: Editor; file: Blob; canvas: HTMLCanvasElement; } export interface CommandScreenshotOptions extends ScreenshotElOptions { el: HTMLElement; } export declare enum StudioScreenshotCommands { screenshot = "studioPlugin:screenshot" }