Skip to main content

$generateNodesFromRawText

function

Convert a raw text string into a flat array of `TextNode`, `LineBreakNode`, and `TabNode` siblings, splitting on `\n`, `\r\n`, and `\t`. Use this when you need the same `\n` / `\t` → real-node conversion that RangeSelection.insertRawText performs but without a selection — e.g. when building a `CodeNode`'s children inside a DOM-import rule.

function $generateNodesFromRawText(text: string): (TextNode | LineBreakNode)[]

Import

import { $generateNodesFromRawText } from '@modular/sdk/editor';