Home > @uniformdev/richtext

richtext package

Functions

Function

Description

getLabelForElement(type)

getLabelForFormat(type)

getRichTextTagFromTableCellHeaderState(headerState)

Convert headerState into relevant tag

getRichTextTagsFromTextFormat(format)

Convert format bitflag for holding text formats into relevant tags

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".

purifyText(text)

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

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