Skip to main content

$generateNodesFromDOM

function

How you parse your html string to get a document is left up to you. In the browser you can use the native DOMParser API to generate a document (see clipboard.ts), but to use in a headless environment you can use JSDom or an equivalent library and pass in the document here.

function $generateNodesFromDOM(editor: LexicalEditor, dom: Document | ParentNode): LexicalNode[]

Import

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