Skip to content

preprocessTextNode

preprocessTextNode(canvas, node, shape, wordWrap, width, listIndent): any

Preprocess text nodes. It mainly handles wordWrap and hardBreak by adding “line” type nodes with additional size info.

options: wordWrap: boolean width: number listIndent: number

Original document node structure: doc = block+ block = paragraph | bulletList | orderedList paragraph = inline+ bulletList = listItem* orderedList = listItem* listItem = block+ inline = text | hardBreak text = hardBreak =

Preprocessed document node structure: doc = block+ block = paragraph | bulletList | orderedList paragraph = line* orderedList = listItem* bulletList = listItem* listItem = block+ line = inline+ inline = text text =

Parameters

canvas: Canvas

node: any

shape: Box

wordWrap: boolean

width: number

listIndent: number

Returns

any

preprocessed text node

Source

utils/text-utils.ts:188