lexical 0.6.4 → 0.7.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
@@ -58,6 +58,8 @@ declare export function createCommand<T>(type?: string): LexicalCommand<T>;
58
58
  /**
59
59
  * LexicalEditor
60
60
  */
61
+ type IntentionallyMarkedAsDirtyElement = Boolean;
62
+
61
63
  type MutationListeners = Map<MutationListener, Class<LexicalNode>>;
62
64
  export type NodeMutation = 'created' | 'updated' | 'destroyed';
63
65
  type UpdateListener = ({
@@ -260,7 +262,6 @@ export const COMMAND_PRIORITY_NORMAL = 2;
260
262
  export const COMMAND_PRIORITY_HIGH = 3;
261
263
  export const COMMAND_PRIORITY_CRITICAL = 4;
262
264
 
263
- export type IntentionallyMarkedAsDirtyElement = boolean;
264
265
  declare export function createEditor(editorConfig?: {
265
266
  editorState?: EditorState,
266
267
  namespace: string,
@@ -330,6 +331,8 @@ declare export class LexicalNode {
330
331
  __type: string;
331
332
  __key: NodeKey;
332
333
  __parent: null | NodeKey;
334
+ __next: null | NodeKey;
335
+ __prev: null | NodeKey;
333
336
  static getType(): string;
334
337
  static clone(data: $FlowFixMe): LexicalNode;
335
338
  static importDOM(): DOMConversionMap | null;
@@ -627,8 +630,7 @@ declare export class LineBreakNode extends LexicalNode {
627
630
  static importJSON(
628
631
  serializedLineBreakNode: SerializedLineBreakNode,
629
632
  ): LineBreakNode;
630
- // $FlowExpectedError[incompatible-extend] 'linebreak' is a literal string
631
- exportJSON(): SerializedLineBreakNode;
633
+ exportJSON(): SerializedLexicalNode;
632
634
  }
633
635
  declare export function $createLineBreakNode(): LineBreakNode;
634
636
  declare export function $isLineBreakNode(
@@ -661,9 +663,18 @@ declare export function $isRootNode(
661
663
  /**
662
664
  * LexicalElementNode
663
665
  */
664
- export type ElementFormatType = 'left' | 'center' | 'right' | 'justify' | '';
666
+ export type ElementFormatType =
667
+ | 'left'
668
+ | 'start'
669
+ | 'center'
670
+ | 'right'
671
+ | 'end'
672
+ | 'justify'
673
+ | '';
665
674
  declare export class ElementNode extends LexicalNode {
666
- __children: Array<NodeKey>;
675
+ __first: null | NodeKey;
676
+ __last: null | NodeKey;
677
+ __size: number;
667
678
  __format: number;
668
679
  __indent: number;
669
680
  __dir: 'ltr' | 'rtl' | null;
@@ -697,7 +708,10 @@ declare export class ElementNode extends LexicalNode {
697
708
  setDirection(direction: 'ltr' | 'rtl' | null): this;
698
709
  setFormat(type: ElementFormatType): this;
699
710
  setIndent(indentLevel: number): this;
700
- insertNewAfter(selection: RangeSelection): null | LexicalNode;
711
+ insertNewAfter(
712
+ selection: RangeSelection,
713
+ restoreSelection?: boolean,
714
+ ): null | LexicalNode;
701
715
  canInsertTab(): boolean;
702
716
  canIndent(): boolean;
703
717
  collapseAtStart(selection: RangeSelection): boolean;
@@ -756,8 +770,7 @@ declare export class ParagraphNode extends ElementNode {
756
770
  static importJSON(
757
771
  serializedParagraphNode: SerializedParagraphNode,
758
772
  ): ParagraphNode;
759
- // $FlowExpectedError[incompatible-extend] 'paragraph' is a literal string
760
- exportJSON(): SerializedParagraphNode;
773
+ exportJSON(): SerializedElementNode;
761
774
  }
762
775
  declare export function $createParagraphNode(): ParagraphNode;
763
776
  declare export function $isParagraphNode(
@@ -809,7 +822,7 @@ declare export function $setSelection(
809
822
  selection: null | RangeSelection | NodeSelection | GridSelection,
810
823
  ): void;
811
824
  declare export function $nodesOfType<T: LexicalNode>(klass: Class<T>): Array<T>;
812
- declare export function $getDecoratorNode(
825
+ declare export function $getAdjacentNode(
813
826
  focus: Point,
814
827
  isBackward: boolean,
815
828
  ): null | LexicalNode;