mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Comments: Switched to lexical editor
Required a lot of changes to provide at least a decent attempt at proper editor teardown control. Also updates HtmlDescriptionFilter and testing to address issue with bad child iteration which could lead to missed items. Renamed editor version from comments to basic as it'll also be used for item descriptions.
This commit is contained in:
@ -20,9 +20,6 @@ import {HeadingNode} from "@lexical/rich-text/LexicalHeadingNode";
|
||||
import {QuoteNode} from "@lexical/rich-text/LexicalQuoteNode";
|
||||
import {CaptionNode} from "@lexical/table/LexicalCaptionNode";
|
||||
|
||||
/**
|
||||
* Load the nodes for lexical.
|
||||
*/
|
||||
export function getNodesForPageEditor(): (KlassConstructor<typeof LexicalNode> | LexicalNodeReplacement)[] {
|
||||
return [
|
||||
CalloutNode,
|
||||
@ -45,6 +42,15 @@ export function getNodesForPageEditor(): (KlassConstructor<typeof LexicalNode> |
|
||||
];
|
||||
}
|
||||
|
||||
export function getNodesForBasicEditor(): (KlassConstructor<typeof LexicalNode> | LexicalNodeReplacement)[] {
|
||||
return [
|
||||
ListNode,
|
||||
ListItemNode,
|
||||
ParagraphNode,
|
||||
LinkNode,
|
||||
];
|
||||
}
|
||||
|
||||
export function registerCommonNodeMutationListeners(context: EditorUiContext): void {
|
||||
const decorated = [ImageNode, CodeBlockNode, DiagramNode];
|
||||
|
||||
@ -53,7 +59,7 @@ export function registerCommonNodeMutationListeners(context: EditorUiContext): v
|
||||
if (mutation === "destroyed") {
|
||||
const decorator = context.manager.getDecoratorByNodeKey(nodeKey);
|
||||
if (decorator) {
|
||||
decorator.destroy(context);
|
||||
decorator.teardown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user