UNPKG

@syncfusion/ej2-richtexteditor

Version:
300 lines (299 loc) 12.6 kB
import { IToolbarStatus, OffsetPosition } from './interface'; import { IsFormatted } from '../editor-manager/plugin/isformatted'; /** * @returns {boolean} - returns boolean value * @hidden */ export declare function isIDevice(): boolean; /** * @param {Element} editableElement - specifies the editable element. * @param {string} selector - specifies the string values. * @returns {void} * @hidden */ export declare function setEditFrameFocus(editableElement: Element, selector: string): void; /** * @param {string} value - specifies the string value * @returns {void} * @hidden */ export declare function updateTextNode(value: string): string; /** * @param {Node} startChildNodes - specifies the node * @returns {void} * @hidden */ export declare function getLastTextNode(startChildNodes: Node): Node; /** * @returns {void} * @hidden */ export declare function getDefaultHtmlTbStatus(): IToolbarStatus; /** * @returns {void} * @hidden */ export declare function getDefaultMDTbStatus(): IToolbarStatus; /** * Checks if the node has any formatting * * @param {Node} node - specifies the node. * @param {IsFormatted} isFormatted - specifies the IsFormatted instance. * @returns {boolean} - returns whether the node has any formatting */ export declare function hasAnyFormatting(node: Node, isFormatted?: IsFormatted): boolean; /** * @param {Range} range - specifies the range * @param {Node} parentNode - specifies the parent node * @returns {void} * @hidden */ export declare function nestedListCleanUp(range: Range, parentNode: Node): void; /** * Method to scroll the content to the cursor position * * @param {Document} document - specifies the document. * @param {HTMLElement | HTMLBodyElement} inputElement - specifies the input element. * @returns {void} */ export declare function scrollToCursor(document: Document, inputElement: HTMLElement | HTMLBodyElement): void; /** * Inserts items at a specific index in an array. * * @template T * @param {Array<T>} oldArray - Specifies the old array. * @param {Array<T>} newArray - Specifies the elements to insert. * @param {number} indexToInsert - Specifies the index to insert. * @returns {Array<T>} - Returns the array after inserting the elements. */ export declare function insertItemsAtIndex<T>(oldArray: Array<T>, newArray: Array<T>, indexToInsert: number): Array<T>; /** * Wrapper function to remove a class from the element and remove the attribute if the class is empty. * * @param {Element[]|NodeList} elements - An array of elements that need to remove a list of classes * @param {string|string[]} classes - String or array of string that need to add an individual element as a class * * @returns {Element[]|NodeList} - Returns the array of elements after removing the class. * @private */ export declare function removeClassWithAttr(elements: Element[] | NodeList, classes: string | string[]): Element[] | NodeList; /** * Creates a two-dimensional array mapping the logical structure of a table. * * @private * @param {HTMLTableElement} table - The HTMLTableElement to process. * @returns {Array.<Array.<HTMLElement>>} A 2D matrix of table cells accounting for colspan and rowspan. * @hidden */ export declare function getCorrespondingColumns(table: HTMLTableElement): HTMLElement[][]; /** * Maps a cell to all its positions in the logical table matrix. * * @param {Array.<Array.<HTMLElement>>} matrix - The 2D matrix being constructed. * @param {HTMLElement} cell - The current cell being placed. * @param {number} startRow - The row index where the cell starts. * @param {number} startCol - The column index where the cell starts. * @param {number} colspan - The number of columns the cell spans. * @param {number} rowspan - The number of rows the cell spans. * @returns {number} - The adjusted starting column index for the next cell in the row. * @hidden */ export declare function mapCellToMatrixPositions(matrix: HTMLElement[][], cell: HTMLElement, startRow: number, startCol: number, colspan: number, rowspan: number): number; /** * Finds the position of a specific cell element in the table matrix. * * @param {HTMLElement} cell - The HTML element to find in the table * @param {Array.<Array.<HTMLElement>>} allCells - The 2D array representing the table structure * @returns {number[]} An array containing the row and column indices [rowIndex, columnIndex], or empty array if not found * @hidden */ export declare function getCorrespondingIndex(cell: HTMLElement, allCells: HTMLElement[][]): number[]; /** * Inserts a <colgroup> with calculated sizes to the table. * This function analyzes the table structure and adds appropriate column definitions * with width values based on the current table layout. * * @param {HTMLTableElement} curTable - The table element to add colgroup to table. * @param {boolean} hasUpdate - Flag indicating whether to update existing colgroup (default: false) * @returns {void} * @hidden */ export declare function insertColGroupWithSizes(curTable: HTMLTableElement, hasUpdate?: boolean): void; /** * Gets the colgroup element from a table * * @param {HTMLTableElement} table - The table element to search in * @returns {HTMLTableColElement | null} The colgroup element or null if not found * @hidden */ export declare function getColGroup(table: HTMLTableElement): HTMLTableColElement | null; /** * Gets the maximum cell count in a table, accounting for colspan attributes. * This function calculates the effective number of columns by examining all rows * and considering the colspan attribute of each cell. * * @param {HTMLTableElement} table - The table element to analyze * @returns {number} - The maximum number of cells/columns in the table * @hidden */ export declare function getMaxCellCount(table: HTMLTableElement): number; /** * Recursively finds the correct column index for a cell, accounting for rowspan cells. * This function adjusts the column index by checking if there are any rowspan cells * from previous rows that occupy the current position. * * @param {Map<string, HTMLTableDataCellElement>} rowSpanCells - Map of rowspan cells with their positions * @param {number} rowIndex - Current row index * @param {number} colIndex - Initial column index to check * @returns {number} - The adjusted column index accounting for rowspan cells * @hidden */ export declare function getCellIndex(rowSpanCells: Map<string, HTMLTableDataCellElement>, rowIndex: number, colIndex: number): number; /** * Converts a pixel measurement to a percentage relative to a container's width. * Used to maintain proper proportions when splitting cells. * * @param {number} value - The pixel value to convert * @param {number} offsetValue - The container width in pixels * @returns {number} The equivalent percentage value * @hidden */ export declare function convertPixelToPercentage(value: number, offsetValue: number): number; /** * @param {string} value - specifies the string value * @param {string} editorMode - specifies the string value * @returns {string} - returns the string value * @hidden */ export declare function resetContentEditableElements(value: string, editorMode: string): string; /** * @param {string} value - specifies the string value * @param {string} editorMode - specifies the string value * @returns {string} - returns the string value * @hidden */ export declare function cleanupInternalElements(value: string, editorMode: string): string; /** * @param {HTMLElement} element - specifies the element * @returns {void} * @hidden */ export declare function removeSelectionClassStates(element: HTMLElement): void; /** * Processes the given inner HTML value and returns a structured HTML string. * * @param {string} innerValue - The inner HTML content to be processed. * @param {string} enterKey - The key used for inserting line breaks. * @param {boolean} enableHtmlEncode - A flag indicating whether HTML encoding should be enabled. * @returns {string} - The structured HTML string. */ export declare function getStructuredHtml(innerValue: string, enterKey: string, enableHtmlEncode: boolean): string; /** * * checks if tag is in set * * @param {Set<string>} set - The set to check for the tag. * @param {string} value - The tag to check for. * * @returns {boolean} - True if the tag is in the set, false otherwise. */ export declare function isInSet(set: Set<string>, value: string): boolean; /** * * Wraps text and inline nodes within a given node to ensure proper HTML structure. * * @param {Node} node - The DOM node whose child nodes are to be wrapped. * @param {string} parentElement - The parent element tag to use for wrapping. * @returns {void} - This function does not return anything. */ export declare function wrapTextAndInlineNodes(node: Node, parentElement: string): void; /** * * Returns the next meaningful sibling of the given node. * * @param {Node} node - The DOM node whose child nodes are to be wrapped. * @returns {Node | null} - Returns a node or null. */ export declare function getNextMeaningfulSibling(node: Node | null): Node | null; /** * * Returns the previous meaningful sibling of the given node. * * @param {Node} node - The DOM node whose child nodes are to be wrapped. * @returns {Node | null} - Returns a node or null. */ export declare function getPreviousMeaningfulSibling(node: Node | null): Node | null; /** * * Checks if the given node is need to be wrapped. * * @param {Node} node - The DOM node whose child nodes are to be wrapped. * @param {Set<string>} blockTags - The set of block tags. * @returns {boolean} - Returns a boolean value. */ export declare function needToWrapLiChild(node: Node, blockTags: Set<string>): boolean; /** * Removes all newlines from a string and replaces consecutive spaces between tags with a single space. * * @param {string} htmlString - The string value from which newlines will be removed. * @param {Element} editNode - The editable element. * @returns {string} - Returns the modified string without newline characters. * @hidden */ export declare function cleanHTMLString(htmlString: string, editNode: Element): string; /** * Converting the base64 url to blob * * @param {string} dataUrl - specifies the string value * @returns {Blob} - returns the blob * @hidden */ export declare function convertToBlob(dataUrl: string): Blob; /** * Escapes HTML characters in a string. * * @param {string} html - The HTML string to be escaped. * @returns {string} The escaped HTML string. */ export declare function escaseHtml(html: string): string; /** * Aligns HTML content by parsing it through the DOM parser and returning the structured HTML. * * @param {string} htmlString - The HTML string to be aligned. * @returns {string} The aligned HTML string. */ export declare function alignmentHtml(htmlString: string): string; /** * Formats a DOM node with proper indentation for improved readability. * * @param {Node} node - The DOM node to format. * @param {number} indentLevel - The current indentation level. * @returns {string} The formatted node as a string with proper indentation. */ export declare function formatNode(node: Node, indentLevel: number): string; /** * Opens a new window, injects the given element and styles, and triggers print. * * @param {Element} element - The element to clone and print. * @param {Window} [printWindow] - Optional existing window, otherwise a new one is created. * @returns {Window} - The print window instance. */ export declare function openPrintWindow(element: Element, printWindow?: Window): Window; /** * Determines the effective root offset parent of a given image or Video element, * * @private * @param {HTMLElement} mediaElement - The image or Video element whose offset parent is to be found. * @param {string} parentID - The ID of the parent element. * @returns {HTMLElement} - The resolved root offset parent element. */ export declare function getRootOffsetParent(mediaElement: HTMLElement, parentID: string): HTMLElement; /** * Determines the image or video element top and left position, * * @private * @param {HTMLElement} mediaElement - The image or Video element whose offset parent is to be found. * @param {HTMLTextAreaElement} rootEle - RichTextEditor root div element. * @returns {OffsetPosition} - The resolved media element top and left position value. */ export declare function getMediaResizeBarValue(mediaElement: HTMLElement, rootEle: HTMLTextAreaElement): OffsetPosition;