lexical 0.12.2 → 0.12.3

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
@@ -272,18 +272,30 @@ export const COMMAND_PRIORITY_NORMAL = 2;
272
272
  export const COMMAND_PRIORITY_HIGH = 3;
273
273
  export const COMMAND_PRIORITY_CRITICAL = 4;
274
274
 
275
+ export type LexicalNodeReplacement = {
276
+ replace: Class<LexicalNode>,
277
+ with: (node: LexicalNode) => LexicalNode,
278
+ withKlass?: Class<LexicalNode>,
279
+ };
280
+
281
+ export type HTMLConfig = {
282
+ export?: Map<
283
+ Class<LexicalNode>,
284
+ (editor: LexicalEditor, target: LexicalNode) => DOMExportOutput,
285
+ >,
286
+ import?: DOMConversionMap,
287
+ };
288
+
275
289
  declare export function createEditor(editorConfig?: {
276
290
  editorState?: EditorState,
277
291
  namespace: string,
278
292
  theme?: EditorThemeClasses,
279
293
  parentEditor?: LexicalEditor,
280
- nodes?: $ReadOnlyArray<
281
- | Class<LexicalNode>
282
- | {replace: Class<LexicalNode>, with: (node: LexicalNode) => LexicalNode},
283
- >,
294
+ nodes?: $ReadOnlyArray<Class<LexicalNode> | LexicalNodeReplacement>,
284
295
  onError: (error: Error) => void,
285
296
  disableEvents?: boolean,
286
297
  editable?: boolean,
298
+ html?: HTMLConfig,
287
299
  }): LexicalEditor;
288
300
 
289
301
  /**
@@ -491,7 +503,7 @@ declare export class RangeSelection implements BaseSelection {
491
503
  insertRawText(text: string): void;
492
504
  removeText(): void;
493
505
  formatText(formatType: TextFormatType): void;
494
- insertNodes(nodes: Array<LexicalNode>, selectStart?: boolean): boolean;
506
+ insertNodes(nodes: Array<LexicalNode>): void;
495
507
  insertParagraph(): void;
496
508
  insertLineBreak(selectStart?: boolean): void;
497
509
  getCharacterOffsets(): [number, number];
@@ -555,10 +567,7 @@ declare export function $getPreviousSelection():
555
567
  | RangeSelection
556
568
  | NodeSelection
557
569
  | GridSelection;
558
- declare export function $insertNodes(
559
- nodes: Array<LexicalNode>,
560
- selectStart?: boolean,
561
- ): boolean;
570
+ declare export function $insertNodes(nodes: Array<LexicalNode>): void;
562
571
  export type GridMapValueType = {
563
572
  cell: deprecated_GridCellNode,
564
573
  startRow: number,
@@ -583,6 +592,7 @@ export type TextFormatType =
583
592
  | 'underline'
584
593
  | 'strikethrough'
585
594
  | 'italic'
595
+ | 'highlight'
586
596
  | 'code'
587
597
  | 'subscript'
588
598
  | 'superscript';