UNPKG

@syncfusion/ej2-richtexteditor

Version:
285 lines (284 loc) 10.9 kB
import { FileInfo, IEditorModel, IPasteModel, NotifyArgs } from '../../common/interface'; /** * PasteCleanup common action * * @hidden */ export declare class PasteCleanupAction { private parent; private pasteModel; private iframeUploadTime; constructor(parent: IEditorModel, pasteModel: IPasteModel); private addEventListener; private removeEventListener; /** * Updates the paste cleanup object with refreshed editor configuration and callback methods * * @param {IPasteModel} updatedPasteModel - The updated paste model with latest configuration * @returns {void} - This method does not return a value * @public * @hidden */ updatePasteCleanupModel(updatedPasteModel: IPasteModel): void; /** * Extracts file from clipboard data if available * * @param {NotifyArgs} e - The notification arguments containing clipboard data * @returns {File} The extracted file from clipboard * @public * @hidden */ extractFileFromClipboard(e: NotifyArgs): File; /** * Splits text by double line breaks and formats it according to editor's enter key configuration * * @param {string} value - The text value to be split and formatted * @returns {string} The formatted text with proper line breaks * @public * @hidden */ splitBreakLine(value: string): string; /** * Gets HTML node tag based on enterKey settings and whether it's start or end tag * * @param {boolean} isStartTag - Indicates whether to return start tag (true) or end tag (false) * @returns {string} The HTML node tag string * @public * @hidden */ getHtmlNode(isStartTag: boolean): string; /** * Converts spaces and tabs in text to HTML space entities. * * @param {string} text - The input text containing spaces and tabs to be converted * @returns {string} The text with spaces and tabs converted to HTML entities * @public * @hidden */ normalizeSpacesForHtml(text: string): string; /** * Converts base64 into file data. * * @param {string} base64 - The base64 encoded string to convert * @param {string} filename - The name for the resulting file * @returns {File} The converted file object * @public * @hidden */ base64ToFile(base64: string, filename: string): File; /** * Sets the image opacity to indicate upload in progress. * * @param {Element} imgElem - The image element to modify opacity for * @returns {void} Nothing is returned * @public * @hidden */ setImageOpacity(imgElem: Element): void; /** * Creates the popup element for upload progress. * * @returns {HTMLElement} The created popup element for displaying upload progress * @public * @hidden */ createPopupElement(): HTMLElement; /** * Converts base64 image sources to blob URLs. * * @param {NodeListOf<HTMLImageElement>} allImgElm - Collection of image elements to process * @returns {void} Nothing is returned * @public * @hidden */ getBlob(allImgElm: NodeListOf<HTMLImageElement>): void; /** * Removes Apple-specific line break elements from the HTML content. * * @param {HTMLElement} clipBoardElem - The HTML element containing clipboard content to clean * @returns {HTMLElement} The cleaned HTML element with Apple-specific line breaks removed * @public * @hidden */ cleanAppleClass(clipBoardElem: HTMLElement): HTMLElement; /** * Removes denied tags and attributes as configured by paste cleanup settings. * * @param {HTMLElement} clipBoardElem - The HTML element containing clipboard content to clean * @param {boolean} clean - Flag indicating whether cleanup should be performed * @returns {HTMLElement} The cleaned HTML element with denied tags and attributes removed * @public * @hidden */ cleanupDeniedTagsAndAttributes(clipBoardElem: HTMLElement, clean: boolean): HTMLElement; /** * Removes elements matching denied tags (with or without attribute selectors) from the provided clipboard element. * * @param {HTMLElement} clipBoardElem - The HTML element containing clipboard content to process * @returns {HTMLElement} The cleaned HTML element with denied tags removed * @public * @hidden */ deniedTags(clipBoardElem: HTMLElement): HTMLElement; /** * Parses denied tags array and filters attributes, supporting allowed and denied (! prefix) attributes. * * @param {string[]} deniedTags - Array of denied tag strings to parse and filter * @returns {string[]} The filtered array of attribute strings * @public * @hidden */ attributesfilter(deniedTags: string[]): string[]; /** * Expands denied tag list by including related tags based on grouping definitions. * * @param {string[]} deniedTags - Array of denied tag strings to expand * @returns {string[]} The expanded array of denied tags including related tags * @public * @hidden */ tagGrouping(deniedTags: string[]): string[]; /** * Removes denied attributes from all elements in the provided clipboard element. * * @param {HTMLElement} clipBoardElem - The HTML element containing clipboard content to process * @param {boolean} clean - Flag indicating whether cleanup should be performed * @returns {HTMLElement} The cleaned HTML element with denied attributes removed * @public * @hidden */ deniedAttributes(clipBoardElem: HTMLElement, clean: boolean): HTMLElement; /** * Filters the inline 'style' attribute on all elements within the clipboard root element, leaving only allowed CSS style properties. * * @param {HTMLElement} clipBoardElem - The HTML element containing clipboard content to process * @returns {HTMLElement} The processed HTML element with filtered style attributes * @public * @hidden */ allowedStyle(clipBoardElem: HTMLElement): HTMLElement; /** * Adds paste class to images and applies image properties. * * @param {HTMLElement} clipBoardElem - The HTML element containing clipboard content with images to process * @returns {void} Nothing is returned * @public * @hidden */ setImageClassAndProps(clipBoardElem: HTMLElement): void; /** * Sets width, height, and min/max styles for inserted images based on editor settings. * * @param {HTMLImageElement} allImg - The image element to apply properties to * @returns {void} Nothing is returned * @public * @hidden */ setImageProperties(allImg: HTMLImageElement): void; /** * Temporarily adds a CSS class to all children of the clipboard element. * * @param {HTMLElement} clipBoardElem - The HTML element containing clipboard content to add temporary classes to * @returns {void} Nothing is returned * @public * @hidden */ addTempClass(clipBoardElem: HTMLElement): void; /** * Checks if there is any <picture> element present. * * @param {HTMLElement} clipBoardElem - The HTML element to check for picture elements * @returns {boolean} True if picture element is found, false otherwise * @public * @hidden */ hasPictureElement(clipBoardElem: HTMLElement): boolean; /** * Processes all <picture> elements to resolve relative srcset attributes in <source> tags * using the base URI or the origin of the image source. * * @param {HTMLElement} clipBoardElem - The HTML element containing picture elements to process * @returns {void} Nothing is returned * @public * @hidden */ processPictureElement(clipBoardElem: HTMLElement): void; /** * Returns true if node has any content (text, images, or table). * * @param {HTMLElement} clipBoardElem - The HTML element to check for content * @returns {boolean} True if the element has content, false otherwise * @public * @hidden */ hasContentToPaste(clipBoardElem: HTMLElement): boolean; /** * Extracts base64-encoded images from the HTML content and converts them to File objects for upload. * * @param {HTMLElement} tempWrapperElem - The HTML element containing base64 images to extract * @returns {FileInfo[]} Array of FileInfo objects containing the converted file data * @public * @hidden */ collectBase64ImageFiles(tempWrapperElem: HTMLElement): FileInfo[]; /** * Adds appropriate class names to tables in the pasted content for formatting or standardization. * * @param {HTMLElement} element - The HTML element containing tables to add classes to * @param {string} [source] - Optional source parameter for context-specific formatting * @returns {HTMLElement} The processed HTML element with table classes added * @public * @hidden */ addTableClass(element: HTMLElement, source?: string): HTMLElement; /** * Removes the temporary CSS class from elements and their class attribute if empty. * * @returns {void} Nothing is returned * @public * @hidden */ removeTempClass(): void; /** * Handles image cropping and blob-to-base64 conversion for images within the provided element. * * @param {HTMLElement} element - The HTML element containing images to be processed. * @returns {void} Nothing is returned * @public * @hidden */ cropImageHandler(element: HTMLElement): void; /** * Processes all images marked for cropping within the editor element using a for loop. * * @param {NodeListOf<HTMLImageElement>} croppedImgs - A NodeList of HTML image elements that are marked for cropping. * @returns {void} Nothing is returned * @public * @hidden */ processCroppedImages(croppedImgs: NodeListOf<HTMLImageElement>): void; /** * Handles blob image conversion to base64 (based on clipboard content) or the general image upload/updateValue logic. * * @returns {void} Nothing is returned * @public * @hidden */ handleBlobOrUpload(): void; /** * Converts all <img> elements with a blob URL source inside the provided element to base64. * * @param {HTMLElement} element - The HTML element containing image elements to be converted from blob URLs to base64. * @returns {void} Nothing is returned * @public * @hidden */ convertBlobToBase64(element: HTMLElement): void; /** * Cleans up resources when the component is destroyed * * @returns {void} - No return value * @public */ destroy(): void; }