1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Lexical: Added custom alignment handling for blocks

To align with pre-existing use of alignment classes.
This commit is contained in:
Dan Brown
2024-08-18 16:51:08 +01:00
parent 0039f893cc
commit 111a313d51
12 changed files with 250 additions and 81 deletions

View File

@ -3,6 +3,7 @@ import {LexicalNodeMatcher} from "../nodes";
import {$createCustomParagraphNode} from "../nodes/custom-paragraph";
import {$generateNodesFromDOM} from "@lexical/html";
import {htmlToDom} from "./dom";
import {NodeHasAlignment} from "../nodes/_common";
function wrapTextNodes(nodes: LexicalNode[]): LexicalNode[] {
return nodes.map(node => {
@ -70,4 +71,8 @@ export function $getNearestBlockNodeForCoords(editor: LexicalEditor, x: number,
}
return null;
}
export function nodeHasAlignment(node: object): node is NodeHasAlignment {
return '__alignment' in node;
}