lexical 0.1.18 → 0.1.21

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.d.ts CHANGED
@@ -78,19 +78,17 @@ type RootListener = (
78
78
  ) => void;
79
79
  type TextContentListener = (text: string) => void;
80
80
  type MutationListener = (nodes: Map<NodeKey, NodeMutation>) => void;
81
- type CommandListener<P> = (payload: P, editor: LexicalEditor) => boolean;
82
81
  export type ReadOnlyListener = (readOnly: boolean) => void;
83
-
84
- type InternalCommandListener = CommandListener<any>;
85
-
86
82
  type Listeners = {
87
83
  decorator: Set<DecoratorListener>;
88
84
  mutation: MutationListeners;
89
85
  textcontent: Set<TextContentListener>;
90
86
  root: Set<RootListener>;
91
87
  update: Set<UpdateListener>;
92
- command: Map<string, Array<Set<InternalCommandListener>>>;
93
88
  };
89
+ type CommandListener<P> = (payload: P, editor: LexicalEditor) => boolean;
90
+ // $FlowFixMe[unclear-type]
91
+ type Commands = Map<LexicalCommand<any>, Array<Set<CommandListener<any>>>>;
94
92
  type RegisteredNodes = Map<string, RegisteredNode>;
95
93
  type RegisteredNode = {
96
94
  klass: Class<LexicalNode>;
@@ -113,6 +111,7 @@ export declare class LexicalEditor {
113
111
  _updating: boolean;
114
112
  _keyToDOMMap: Map<NodeKey, HTMLElement>;
115
113
  _listeners: Listeners;
114
+ _commands: Commands;
116
115
  _nodes: RegisteredNodes;
117
116
  _onError: ErrorHandler;
118
117
  _decorators: Record<NodeKey, unknown>;
@@ -311,6 +310,10 @@ export type DOMConversionOutput = {
311
310
  forChild?: DOMChildConversion;
312
311
  node: LexicalNode | null;
313
312
  };
313
+ export type DOMExportOutput = {
314
+ after?: (generatedElement: ?HTMLElement) => ?HTMLElement;
315
+ element: HTMLElement | null;
316
+ };
314
317
  export type NodeKey = string;
315
318
  export declare class LexicalNode {
316
319
  __type: string;
@@ -318,7 +321,7 @@ export declare class LexicalNode {
318
321
  __parent: null | NodeKey;
319
322
  getType(): string;
320
323
  clone(data: any): LexicalNode;
321
- convertDOM(): DOMConversionMap | null;
324
+ importDOM(): DOMConversionMap | null;
322
325
  constructor(key?: NodeKey);
323
326
  getType(): string;
324
327
  isAttached(): boolean;
@@ -351,6 +354,7 @@ export declare class LexicalNode {
351
354
  includeInert?: boolean,
352
355
  includeDirectionless?: false,
353
356
  ): number;
357
+ exportDOM(editor: LexicalEditor): DOMExportOutput;
354
358
  // $FlowFixMe
355
359
  createDOM<EditorContext extends Record<string, any>>(
356
360
  config: EditorConfig<EditorContext>,
@@ -429,6 +433,7 @@ export declare class GridSelection {
429
433
  clone(): GridSelection;
430
434
  extract(): Array<LexicalNode>;
431
435
  isCollapsed(): boolean;
436
+ isBackward(): boolean;
432
437
  insertRawText(): void;
433
438
  insertText(): void;
434
439
  getShape(): GridSelectionShape;