From 05ddbcc3a2d43d340a9b1619376467fda05f9bd9 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 26 Dec 2024 03:37:50 +0100 Subject: [PATCH] [lexical] Bug Fix: Flow is missing some variables and functions (#6977) --- packages/lexical/flow/Lexical.js.flow | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/lexical/flow/Lexical.js.flow b/packages/lexical/flow/Lexical.js.flow index 75528066d94..28990489203 100644 --- a/packages/lexical/flow/Lexical.js.flow +++ b/packages/lexical/flow/Lexical.js.flow @@ -262,6 +262,7 @@ export type EditorThemeClasses = { ulDepth?: Array, ol?: EditorThemeClassName, olDepth?: Array, + checklist?: EditorThemeClassName, listitem?: EditorThemeClassName, listitemChecked?: EditorThemeClassName, listitemUnchecked?: EditorThemeClassName, @@ -361,7 +362,7 @@ export type DOMConversion = { conversion: DOMConversionFn, priority: 0 | 1 | 2 | 3 | 4, }; -export type DOMConversionFn = (element: Node) => DOMConversionOutput; +export type DOMConversionFn = (element: Node) => DOMConversionOutput | null; export type DOMChildConversion = ( lexicalNode: LexicalNode, parentLexicalNode: ?LexicalNode | null, @@ -452,13 +453,16 @@ declare export function $isBlockElementNode( ): node is ElementNode; export interface BaseSelection { - clone(): BaseSelection; dirty: boolean; + clone(): BaseSelection; extract(): Array; getNodes(): Array; + getStartEndPoints(): null | [PointType, PointType]; getTextContent(): string; insertRawText(text: string): void; is(selection: null | BaseSelection): boolean; + isBackward(): boolean; + isCollapsed(): boolean; insertText(text: string): void; insertNodes(nodes: Array): void; getCachedNodes(): null | Array; @@ -470,6 +474,8 @@ declare export class NodeSelection implements BaseSelection { dirty: boolean; constructor(objects: Set): void; is(selection: null | BaseSelection): boolean; + isBackward(): boolean; + isCollapsed(): boolean; add(key: NodeKey): void; delete(key: NodeKey): void; clear(): void; @@ -479,6 +485,7 @@ declare export class NodeSelection implements BaseSelection { insertRawText(): void; insertText(): void; getNodes(): Array; + getStartEndPoints(): null; getTextContent(): string; insertNodes(nodes: Array): void; getCachedNodes(): null | Array; @@ -494,6 +501,7 @@ declare export class RangeSelection implements BaseSelection { focus: PointType; dirty: boolean; format: number; + style: string; constructor(anchor: PointType, focus: PointType, format: number): void; is(selection: null | BaseSelection): boolean; isBackward(): boolean; @@ -531,6 +539,8 @@ declare export class RangeSelection implements BaseSelection { insertNodes(nodes: Array): void; getCachedNodes(): null | Array; setCachedNodes(nodes: null | Array): void; + forwardDeletion(anchor: PointType, anchorNode: ElementNode | TextNode, isBackward: boolean): boolean; + getStartEndPoints(): null | [PointType, PointType]; } export type TextPoint = TextPointType; type TextPointType = {