Static Functions
6 Jul 20267 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
convertFontSize
Converts font size from one unit to another.
| Parameter | Type | Description |
|---|---|---|
| value | number |
The font size value to convert. |
| originalUnit | string |
The original unit of the font size. |
| targetUnit | string |
The target unit to convert the font size to. |
Returns number
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. |
| isFromPaste (optional) | boolean |
A flag indicating whether the content is from the paste operation. |
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
isBlockNode
Checks if the given HTML element is a block-level element.
| Parameter | Type | Description |
|---|---|---|
| element | Element |
The HTML element to check. |
Returns boolean
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. |
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. |
| ignoreElements (optional) | Set |
An optional set of elements to ignore during wrapping. |
Returns void