lexical 0.9.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Lexical.js.flow CHANGED
@@ -7,6 +7,8 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
+ import type {FindCachedParentDOMNode} from '@lexical/html';
11
+
10
12
  /**
11
13
  * LexicalCommands
12
14
  */
@@ -36,6 +38,7 @@ declare export var KEY_BACKSPACE_COMMAND: LexicalCommand<KeyboardEvent>;
36
38
  declare export var KEY_ESCAPE_COMMAND: LexicalCommand<KeyboardEvent>;
37
39
  declare export var KEY_DELETE_COMMAND: LexicalCommand<KeyboardEvent>;
38
40
  declare export var KEY_TAB_COMMAND: LexicalCommand<KeyboardEvent>;
41
+ declare export var INSERT_TAB_COMMAND: LexicalCommand<void>;
39
42
  declare export var KEY_MODIFIER_COMMAND: LexicalCommand<KeyboardEvent>;
40
43
  declare export var INDENT_CONTENT_COMMAND: LexicalCommand<void>;
41
44
  declare export var OUTDENT_CONTENT_COMMAND: LexicalCommand<void>;
@@ -100,7 +103,7 @@ type RegisteredNode = {
100
103
  klass: Class<LexicalNode>,
101
104
  transforms: Set<Transform<LexicalNode>>,
102
105
  };
103
- type Transform<T> = (node: T) => void;
106
+ export type Transform<T> = (node: T) => void;
104
107
 
105
108
  type DOMConversionCache = Map<
106
109
  string,
@@ -307,7 +310,7 @@ export type DOMConversion = {
307
310
  };
308
311
  export type DOMConversionFn = (
309
312
  element: Node,
310
- parent?: Node,
313
+ findCachedParentDOMNode: FindCachedParentDOMNode,
311
314
  ) => DOMConversionOutput;
312
315
  export type DOMChildConversion = (
313
316
  lexicalNode: LexicalNode,
@@ -320,7 +323,7 @@ type NodeName = string;
320
323
  export type DOMConversionOutput = {
321
324
  after?: (childLexicalNodes: Array<LexicalNode>) => Array<LexicalNode>,
322
325
  forChild?: DOMChildConversion,
323
- node: LexicalNode | null,
326
+ node: null | LexicalNode | Array<LexicalNode>,
324
327
  };
325
328
  export type DOMExportOutput = {
326
329
  after?: (generatedElement: ?HTMLElement) => ?HTMLElement,
@@ -636,6 +639,27 @@ declare export function $isTextNode(
636
639
  node: ?LexicalNode,
637
640
  ): boolean %checks(node instanceof TextNode);
638
641
 
642
+ /**
643
+ * LexicalTabNode
644
+ */
645
+
646
+ export type SerializedTabNode = SerializedTextNode;
647
+
648
+ declare export function $createTabNode(): TabNode;
649
+
650
+ declare export function $isTabNode(
651
+ node: LexicalNode | null | void,
652
+ ): boolean %checks(node instanceof TabNode);
653
+
654
+ declare export class TabNode extends TextNode {
655
+ static getType(): string;
656
+ static clone(node: TabNode): TabNode;
657
+ constructor(key?: NodeKey): void;
658
+ static importDOM(): DOMConversionMap | null;
659
+ static importJSON(serializedTabNode: SerializedTabNode): TabNode;
660
+ exportJSON(): SerializedTabNode;
661
+ }
662
+
639
663
  /**
640
664
  * LexicalLineBreakNode
641
665
  */
@@ -732,7 +756,6 @@ declare export class ElementNode extends LexicalNode {
732
756
  selection: RangeSelection,
733
757
  restoreSelection?: boolean,
734
758
  ): null | LexicalNode;
735
- canInsertTab(): boolean;
736
759
  canIndent(): boolean;
737
760
  collapseAtStart(selection: RangeSelection): boolean;
738
761
  excludeFromCopy(destination: 'clone' | 'html'): boolean;