Home > @uniformdev/richtext

richtext package

Functions

Function

Description

getLabelForElement(type)

getLabelForFormat(type)

getRichTextListItemValue(value)

Normalizes an optional serialized list item ordinal while preserving invalid explicit values.

getRichTextListStart(start)

Normalizes an optional serialized list start while preserving invalid explicit values.

getRichTextTagFromTableCellHeaderState(headerState)

Convert headerState into relevant tag. Missing or 0 means a body cell (td).

getRichTextTagsFromTextFormat(format)

Convert format bitflag for holding text formats into relevant tags. Missing format is treated as 0 (no formatting), matching the serialized default.

hasChildren(node)

isArrayWithLength(arr)

isDangerousLinkAttributeKey(key)

True for attribute keys the Uniform web SDKs strip at render time: inline event handlers (on*) and dangerous attribute names (href, src, style, formaction). Authoring UIs should use this to warn before such keys are ever persisted.

isPureDirection(direction)

isPureTextAlign(format)

isRichTextNode(node)

isRichTextNodeType(node, type)

isRichTextNodeType(node, type)

isRichTextNodeType(node, type)

isRichTextNodeType(node, type)

isRichTextNodeType(node, type)

isRichTextNodeType(node, type)

isRichTextNodeType(node, type)

isRichTextNodeType(node, type)

isRichTextValue(value)

isRichTextValueConsideredEmpty(value)

linkParamValueToAnchorProps(link)

Converts a link parameter value into a React-compatible anchor prop bag. Delegates to linkParamValueToHtmlAttributes for the security denylist / auto-rel logic, then renames the literal class key to className for React.

linkParamValueToHref(link)

Derives the href string from a link parameter value.

linkParamValueToHtmlAttributes(link)

Converts a link parameter value into a plain HTML attribute bag suitable for an <a> element. Applies a web-channel security denylist (event handlers, script-executing URL schemes on the href and any value, dangerous attribute names) and auto-adds rel="noopener noreferrer" for any case variant of target="_blank".

omitDefaultRichTextProperties(value)

Returns a clone with SDK-compatible Lexical default-valued properties removed. The input is not mutated, so stored or immer-frozen values are safe to pass directly.

purifyText(text)

rehydrateDefaultRichTextProperties(value)

Returns a clone of the rich text value with omitted Lexical defaults restored. The input is not mutated, so stored or immer-frozen values are safe to pass directly.

renderChildrenToHtml(children, context)

Render an array of RichTextNodes to a string based on a particular context.

This will often be called from within a NodeRenderer using the renderChildren prop.

renderChildrenToText(children, context)

Render an array of RichTextNodes to a string based on a particular context.

This will often be called from within a NodeRenderer using the renderChildren prop.

renderHtmlElement(tag, attributes, children)

renderToHtml(node, parentContext)

Render a node and its children to HTML

This could be the root node or a nested node

renderToText(node, parentContext)

Render a node and its children to text

This could be the root node or a nested node

resolveLinkAttrConfig(entry)

Normalize a stored entry for rendering — fills in a default label.

walkRichTextTree(node, callback, parent)

Interfaces

Interface

Description

AssetNode

HeadingNode

LinkAttrConfig

One entry in the link-attributes config list. options, and helpText are optional presentation hints. The React SDK translates the literal class key to className on output.

LinkAttributesConfiguration

LinkNode

ListItemNode

ListNode

NodeStringRendererProps

ParagraphNode

RichTextNode

Serialized Lexical node as stored on Uniform rich text parameters.

Stored payloads may omit default-valued properties. Custom renderers must treat a missing version as 1.

RichTextParamConfiguration

StringRenderContext

TableCellNode

TextNode

Variables

Variable

Description

assetHtmlRenderer

defaultParameterConfiguration

emptyRichTextValue

headingHtmlRenderer

linkHtmlRenderer

listHtmlRenderer

listitemHtmlRenderer

paragraphHtmlRenderer

resolveDefaultHtmlRenderer

When a custom renderer has not been provided we check to see if there is a renderer for the type within the map above. These are for any node types which include extra logic.

Some node types like quote just map directly to a HTML tag (ie blockquote). For those there is a simple type -> tag Map.

resolveDefaultTextRenderer

When a custom renderer has not been provided we check to see if there is a renderer for the type within the map above. These are for any node types which include extra logic.

richTextBuiltInElements

richTextBuiltInFormats

rootHtmlRenderer

tablecellHtmlRenderer

tableHtmlRenderer

tablerowHtmlRenderer

textHtmlRenderer

Type Aliases

Type Alias

Description

NodeStringRenderer

ParameterRichTextValue

ResolveStringRenderer

RichTextBuiltInElement

RichTextBuiltInFormat

RichTextNodeWithChildren

TableNode

TableRowNode