/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module email/emailinlinestylestransformations * @publicApi */ import { type ExportInlineStylesTransformation } from '@ckeditor/ckeditor5-export-inline-styles'; import type { StylesMap } from '@ckeditor/ckeditor5-engine'; /** * Returns a collection of style property transformations designed for email compatibility. * * These transformations convert modern CSS styles into HTML attributes better * supported by email clients. The transformations focus on converting alignment-related * CSS properties into corresponding HTML attributes. * * Examples of transformations: * * 1. Float to align: * * `` → `` * * 2. Shorthand margin for centering: * * `
` → * `
` * * Note: * * * The `align` attribute is only applied to the `img` elements. * * Tables aligned via margins are wrapped in a container table to ensure proper positioning in all email clients. * * The `align` attribute overrides any existing alignment attributes on these elements. * * If the `float` and `margin` are present, the `float` property takes precedence for alignment. * * The style attributes remain unchanged. * * @param options Configuration options. * @param options.useFigureToTableFallback Enables the transformation of figure elements into tables. * This option allows using block images in older email clients but causes additional * wrapping of elements with tables and might affect the layout. * @returns An array of transformations to be applied to style properties for email compatibility. */ export declare function getEmailInlineStylesTransformations(options?: EmailInlineStylesTransformationsOptions): Array; /** * Configuration options for email inline styles transformations. */ export interface EmailInlineStylesTransformationsOptions { /** * Enables the transformation of `
` elements into `tables`. * * This option allows using block images in older email clients but causes additional wrapping of elements with tables. */ useFigureToTableFallback?: boolean; } /** * Transform float: left/right to align="left"/"right" for table and img elements. * * Examples: * * `` → `
` * * `` → `` * * @param element The element to transform. * @param stylesMap A map of CSS styles applied to the element. */ export declare function transformEmailFloatToAlign(element: Element, stylesMap: StylesMap): void; /** * Handle margin-left and margin-right combinations for alignment of the table element. * It skips elements with float style because float has higher priority for alignment. * * It wraps the `
` in a container `
` to ensure proper alignment in all email clients. * * Examples: * * `
` → * `
...
` * * * `` → * `
...
...` * * @param element The element to transform. * @param stylesMap A map of CSS styles applied to the element. */ export declare function transformEmailMarginToAlign(element: Element, stylesMap: StylesMap): void; /** * Removes width and height attributes from images that have width defined in styles. * This helps to prevent issues with image scaling in some email clients. * * Example: * * `` → `` * * @param element The element to transform. * @param stylesMap A map of CSS styles applied to the element. */ export declare function transformEmailImageWidthAttributes(element: Element, stylesMap: StylesMap): void; /** * Replacing the `
` element with one or two tables to handle alignment and width for better email compatibility. * * Examples: * * `
` → * `
...
` * * * `
` → * `
...
` * * * `
` → * `
...
` * * @param element The element to transform. * @param stylesMap A map of CSS styles applied to the element. */ export declare function transformEmailFigureToTable(element: Element, stylesMap: StylesMap): HTMLElement | undefined; /** * Transforms a FIGCAPTION element into a DIV element to make it more compatible with email clients. * * @param element The element to transform. * @returns The new DIV element or `undefined` if no transformation was applied. */ export declare function transformEmailFigcaptionToDiv(element: Element): HTMLElement | undefined;