1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-12-13 07:42:23 +03:00

Lexical API: Added content module, testing and documented

This commit is contained in:
Dan Brown
2025-12-05 12:15:18 +00:00
parent ebceba0afe
commit dfdcfcfdb8
9 changed files with 202 additions and 25 deletions

View File

@@ -25,10 +25,13 @@ function wrapTextNodes(nodes: LexicalNode[]): LexicalNode[] {
});
}
export function $htmlToBlockNodes(editor: LexicalEditor, html: string): LexicalNode[] {
export function $htmlToNodes(editor: LexicalEditor, html: string): LexicalNode[] {
const dom = htmlToDom(html);
const nodes = $generateNodesFromDOM(editor, dom);
return wrapTextNodes(nodes);
return $generateNodesFromDOM(editor, dom);
}
export function $htmlToBlockNodes(editor: LexicalEditor, html: string): LexicalNode[] {
return wrapTextNodes($htmlToNodes(editor, html));
}
export function $getParentOfType(node: LexicalNode, matcher: LexicalNodeMatcher): LexicalNode | null {