Static Functions

12 Sep 20256 minutes to read

Root static functions of RichTextEditor Component

alignmentHtml

Aligns HTML content by parsing it through the DOM parser and returning the structured HTML.

Parameter Type Description
htmlString string The HTML string to be aligned.

Returns string

escaseHtml

Escapes HTML characters in a string.

Parameter Type Description
html string The HTML string to be escaped.

Returns string

formatNode

Formats a DOM node with proper indentation for improved readability.

Parameter Type Description
node Node The DOM node to format.
indentLevel number The current indentation level.

Returns string

getNextMeaningfulSibling

Returns the next meaningful sibling of the given node.

Parameter Type Description
node Node | null The DOM node whose child nodes are to be wrapped.

Returns Node | null

getPreviousMeaningfulSibling

Returns the previous meaningful sibling of the given node.

Parameter Type Description
node Node | null The DOM node whose child nodes are to be wrapped.

Returns Node | null

getStructuredHtml

Processes the given inner HTML value and returns a structured HTML string.

Parameter Type Description
innerValue string The inner HTML content to be processed.
enterKey string The key used for inserting line breaks.
enableHtmlEncode boolean A flag indicating whether HTML encoding should be enabled.

Returns string

hasAnyFormatting

Checks if the node has any formatting

Parameter Type Description
node Node specifies the node.
isFormatted IsFormatted specifies the IsFormatted instance.

Returns boolean

insertItemsAtIndex

Inserts items at a specific index in an array.

Parameter Type Description
oldArray Array Specifies the old array.
newArray Array Specifies the elements to insert.
indexToInsert number Specifies the index to insert.

Returns Array

isInSet

checks if tag is in set

Parameter Type Description
set Set The set to check for the tag.
value string The tag to check for.

Returns boolean

needToWrapLiChild

Checks if the given node is need to be wrapped.

Parameter Type Description
node Node The DOM node whose child nodes are to be wrapped.
blockTags Set The set of block tags.

Returns boolean

openPrintWindow

Opens a new window, injects the given element and styles, and triggers print.

Returns Window

scrollToCursor

Method to scroll the content to the cursor position

Parameter Type Description
document Document specifies the document.
inputElement HTMLElement | HTMLBodyElement specifies the input element.

Returns void

wrapTextAndInlineNodes

Wraps text and inline nodes within a given node to ensure proper HTML structure.

Parameter Type Description
node Node The DOM node whose child nodes are to be wrapped.
parentElement string The parent element tag to use for wrapping.

Returns void