2024-05-27 15:23:45 -04:00
|
|
|
import {HeadingNode, QuoteNode} from '@lexical/rich-text';
|
2024-05-28 10:09:50 -04:00
|
|
|
import {CalloutNode} from './callout';
|
2024-05-28 13:04:48 -04:00
|
|
|
import {ElementNode, KlassConstructor, LexicalNode, LexicalNodeReplacement, ParagraphNode} from "lexical";
|
2024-05-28 10:09:50 -04:00
|
|
|
import {CustomParagraphNode} from "./custom-paragraph";
|
2024-05-29 15:38:31 -04:00
|
|
|
import {LinkNode} from "@lexical/link";
|
2024-06-03 11:56:31 -04:00
|
|
|
import {ImageNode} from "./image";
|
2024-06-06 09:43:50 -04:00
|
|
|
import {DetailsNode, SummaryNode} from "./details";
|
2024-06-19 11:14:20 -04:00
|
|
|
import {ListItemNode, ListNode} from "@lexical/list";
|
2024-06-21 08:47:47 -04:00
|
|
|
import {TableCellNode, TableNode, TableRowNode} from "@lexical/table";
|
2024-06-24 15:50:17 -04:00
|
|
|
import {CustomTableNode} from "./custom-table";
|
2024-06-27 10:48:06 -04:00
|
|
|
import {HorizontalRuleNode} from "./horizontal-rule";
|
2024-05-27 15:23:45 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Load the nodes for lexical.
|
|
|
|
*/
|
2024-05-28 10:09:50 -04:00
|
|
|
export function getNodesForPageEditor(): (KlassConstructor<typeof LexicalNode> | LexicalNodeReplacement)[] {
|
2024-05-27 15:23:45 -04:00
|
|
|
return [
|
2024-05-28 10:09:50 -04:00
|
|
|
CalloutNode, // Todo - Create custom
|
|
|
|
HeadingNode, // Todo - Create custom
|
|
|
|
QuoteNode, // Todo - Create custom
|
2024-06-19 11:14:20 -04:00
|
|
|
ListNode, // Todo - Create custom
|
|
|
|
ListItemNode,
|
2024-06-24 15:50:17 -04:00
|
|
|
CustomTableNode,
|
2024-06-21 08:47:47 -04:00
|
|
|
TableRowNode,
|
|
|
|
TableCellNode,
|
2024-06-03 11:56:31 -04:00
|
|
|
ImageNode,
|
2024-06-27 10:48:06 -04:00
|
|
|
HorizontalRuleNode,
|
2024-06-06 09:43:50 -04:00
|
|
|
DetailsNode, SummaryNode,
|
2024-05-28 10:09:50 -04:00
|
|
|
CustomParagraphNode,
|
2024-06-24 15:50:17 -04:00
|
|
|
LinkNode,
|
2024-05-28 10:09:50 -04:00
|
|
|
{
|
|
|
|
replace: ParagraphNode,
|
|
|
|
with: (node: ParagraphNode) => {
|
|
|
|
return new CustomParagraphNode();
|
|
|
|
}
|
2024-05-29 15:38:31 -04:00
|
|
|
},
|
2024-06-24 15:50:17 -04:00
|
|
|
{
|
|
|
|
replace: TableNode,
|
|
|
|
with(node: TableNode) {
|
|
|
|
return new CustomTableNode();
|
|
|
|
}
|
|
|
|
},
|
2024-05-27 15:23:45 -04:00
|
|
|
];
|
|
|
|
}
|
2024-05-28 13:04:48 -04:00
|
|
|
|
|
|
|
export type LexicalNodeMatcher = (node: LexicalNode|null|undefined) => boolean;
|
|
|
|
export type LexicalElementNodeCreator = () => ElementNode;
|