1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-12-05 17:22:06 +03:00
Files
bookstack/resources/js/wysiwyg/nodes/index.ts
2024-05-28 18:04:48 +01:00

25 lines
898 B
TypeScript

import {HeadingNode, QuoteNode} from '@lexical/rich-text';
import {CalloutNode} from './callout';
import {ElementNode, KlassConstructor, LexicalNode, LexicalNodeReplacement, ParagraphNode} from "lexical";
import {CustomParagraphNode} from "./custom-paragraph";
/**
* Load the nodes for lexical.
*/
export function getNodesForPageEditor(): (KlassConstructor<typeof LexicalNode> | LexicalNodeReplacement)[] {
return [
CalloutNode, // Todo - Create custom
HeadingNode, // Todo - Create custom
QuoteNode, // Todo - Create custom
CustomParagraphNode,
{
replace: ParagraphNode,
with: (node: ParagraphNode) => {
return new CustomParagraphNode();
}
}
];
}
export type LexicalNodeMatcher = (node: LexicalNode|null|undefined) => boolean;
export type LexicalElementNodeCreator = () => ElementNode;