mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-04 23:13:41 +08:00
dc1a40ea74
Structured UI logical to be fairly standard and mostly covered via a base class that handles context and core dom work.
27 lines
957 B
TypeScript
27 lines
957 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";
|
|
import {LinkNode} from "@lexical/link";
|
|
|
|
/**
|
|
* 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();
|
|
}
|
|
},
|
|
LinkNode,
|
|
];
|
|
}
|
|
|
|
export type LexicalNodeMatcher = (node: LexicalNode|null|undefined) => boolean;
|
|
export type LexicalElementNodeCreator = () => ElementNode; |