]> BookStack Code Mirror - bookstack/blob - resources/js/wysiwyg/nodes/index.ts
Lexical: Added ui container type
[bookstack] / resources / js / wysiwyg / nodes / index.ts
1 import {HeadingNode, QuoteNode} from '@lexical/rich-text';
2 import {CalloutNode} from './callout';
3 import {ElementNode, KlassConstructor, LexicalNode, LexicalNodeReplacement, ParagraphNode} from "lexical";
4 import {CustomParagraphNode} from "./custom-paragraph";
5 import {LinkNode} from "@lexical/link";
6
7 /**
8  * Load the nodes for lexical.
9  */
10 export function getNodesForPageEditor(): (KlassConstructor<typeof LexicalNode> | LexicalNodeReplacement)[] {
11     return [
12         CalloutNode, // Todo - Create custom
13         HeadingNode, // Todo - Create custom
14         QuoteNode, // Todo - Create custom
15         CustomParagraphNode,
16         {
17             replace: ParagraphNode,
18             with: (node: ParagraphNode) => {
19                 return new CustomParagraphNode();
20             }
21         },
22         LinkNode,
23     ];
24 }
25
26 export type LexicalNodeMatcher = (node: LexicalNode|null|undefined) => boolean;
27 export type LexicalElementNodeCreator = () => ElementNode;