lexical 0.6.5 → 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(
@@ -670,7 +672,9 @@ export type ElementFormatType =
670
672
  | 'justify'
671
673
  | '';
672
674
  declare export class ElementNode extends LexicalNode {
673
- __children: Array<NodeKey>;
675
+ __first: null | NodeKey;
676
+ __last: null | NodeKey;
677
+ __size: number;
674
678
  __format: number;
675
679
  __indent: number;
676
680
  __dir: 'ltr' | 'rtl' | null;
@@ -704,7 +708,10 @@ declare export class ElementNode extends LexicalNode {
704
708
  setDirection(direction: 'ltr' | 'rtl' | null): this;
705
709
  setFormat(type: ElementFormatType): this;
706
710
  setIndent(indentLevel: number): this;
707
- insertNewAfter(selection: RangeSelection): null | LexicalNode;
711
+ insertNewAfter(
712
+ selection: RangeSelection,
713
+ restoreSelection?: boolean,
714
+ ): null | LexicalNode;
708
715
  canInsertTab(): boolean;
709
716
  canIndent(): boolean;
710
717
  collapseAtStart(selection: RangeSelection): boolean;
@@ -763,8 +770,7 @@ declare export class ParagraphNode extends ElementNode {
763
770
  static importJSON(
764
771
  serializedParagraphNode: SerializedParagraphNode,
765
772
  ): ParagraphNode;
766
- // $FlowExpectedError[incompatible-extend] 'paragraph' is a literal string
767
- exportJSON(): SerializedParagraphNode;
773
+ exportJSON(): SerializedElementNode;
768
774
  }
769
775
  declare export function $createParagraphNode(): ParagraphNode;
770
776
  declare export function $isParagraphNode(
@@ -816,7 +822,7 @@ declare export function $setSelection(
816
822
  selection: null | RangeSelection | NodeSelection | GridSelection,
817
823
  ): void;
818
824
  declare export function $nodesOfType<T: LexicalNode>(klass: Class<T>): Array<T>;
819
- declare export function $getDecoratorNode(
825
+ declare export function $getAdjacentNode(
820
826
  focus: Point,
821
827
  isBackward: boolean,
822
828
  ): null | LexicalNode;