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.
@@ -34,6 +34,7 @@ export declare const KEY_BACKSPACE_COMMAND: LexicalCommand<KeyboardEvent>;
34
34
  export declare const KEY_ESCAPE_COMMAND: LexicalCommand<KeyboardEvent>;
35
35
  export declare const KEY_DELETE_COMMAND: LexicalCommand<KeyboardEvent>;
36
36
  export declare const KEY_TAB_COMMAND: LexicalCommand<KeyboardEvent>;
37
+ export declare const INSERT_TAB_COMMAND: LexicalCommand<void>;
37
38
  export declare const INDENT_CONTENT_COMMAND: LexicalCommand<void>;
38
39
  export declare const OUTDENT_CONTENT_COMMAND: LexicalCommand<void>;
39
40
  export declare const DROP_COMMAND: LexicalCommand<DragEvent>;
package/LexicalNode.d.ts CHANGED
@@ -18,15 +18,14 @@ export declare type DOMConversion<T extends HTMLElement = HTMLElement> = {
18
18
  conversion: DOMConversionFn<T>;
19
19
  priority: 0 | 1 | 2 | 3 | 4;
20
20
  };
21
- export declare type DOMConversionFn<T extends HTMLElement = HTMLElement> = (element: T, parent?: Node, preformatted?: boolean) => DOMConversionOutput | null;
21
+ export declare type DOMConversionFn<T extends HTMLElement = HTMLElement> = (element: T) => DOMConversionOutput | null;
22
22
  export declare type DOMChildConversion = (lexicalNode: LexicalNode, parentLexicalNode: LexicalNode | null | undefined) => LexicalNode | null | undefined;
23
23
  export declare type DOMConversionMap<T extends HTMLElement = HTMLElement> = Record<NodeName, (node: T) => DOMConversion<T> | null>;
24
24
  declare type NodeName = string;
25
25
  export declare type DOMConversionOutput = {
26
26
  after?: (childLexicalNodes: Array<LexicalNode>) => Array<LexicalNode>;
27
27
  forChild?: DOMChildConversion;
28
- node: LexicalNode | null;
29
- preformatted?: boolean;
28
+ node: null | LexicalNode | Array<LexicalNode>;
30
29
  };
31
30
  export declare type DOMExportOutput = {
32
31
  after?: (generatedElement: HTMLElement | null | undefined) => HTMLElement | null | undefined;
@@ -141,6 +141,7 @@ export declare class RangeSelection implements BaseSelection {
141
141
  deleteWord(isBackward: boolean): void;
142
142
  }
143
143
  export declare function $isNodeSelection(x: unknown): x is NodeSelection;
144
+ export declare function $isBlockElementNode(node: LexicalNode | null | undefined): node is ElementNode;
144
145
  export declare function internalMakeRangeSelection(anchorKey: NodeKey, anchorOffset: number, focusKey: NodeKey, focusOffset: number, anchorType: 'text' | 'element', focusType: 'text' | 'element'): RangeSelection;
145
146
  export declare function $createRangeSelection(): RangeSelection;
146
147
  export declare function $createNodeSelection(): NodeSelection;
package/index.d.ts CHANGED
@@ -15,11 +15,11 @@ export type { ElementFormatType, SerializedElementNode, } from './nodes/LexicalE
15
15
  export type { SerializedGridCellNode } from './nodes/LexicalGridCellNode';
16
16
  export type { SerializedRootNode } from './nodes/LexicalRootNode';
17
17
  export type { SerializedTextNode, TextFormatType, TextModeType, } from './nodes/LexicalTextNode';
18
- export { BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, CLEAR_EDITOR_COMMAND, CLEAR_HISTORY_COMMAND, CLICK_COMMAND, CONTROLLED_TEXT_INSERTION_COMMAND, COPY_COMMAND, createCommand, CUT_COMMAND, DELETE_CHARACTER_COMMAND, DELETE_LINE_COMMAND, DELETE_WORD_COMMAND, DRAGEND_COMMAND, DRAGOVER_COMMAND, DRAGSTART_COMMAND, DROP_COMMAND, FOCUS_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, INDENT_CONTENT_COMMAND, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_DOWN_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, KEY_MODIFIER_COMMAND, KEY_SPACE_COMMAND, KEY_TAB_COMMAND, MOVE_TO_END, MOVE_TO_START, OUTDENT_CONTENT_COMMAND, PASTE_COMMAND, REDO_COMMAND, REMOVE_TEXT_COMMAND, SELECTION_CHANGE_COMMAND, UNDO_COMMAND, } from './LexicalCommands';
18
+ export { BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, CLEAR_EDITOR_COMMAND, CLEAR_HISTORY_COMMAND, CLICK_COMMAND, CONTROLLED_TEXT_INSERTION_COMMAND, COPY_COMMAND, createCommand, CUT_COMMAND, DELETE_CHARACTER_COMMAND, DELETE_LINE_COMMAND, DELETE_WORD_COMMAND, DRAGEND_COMMAND, DRAGOVER_COMMAND, DRAGSTART_COMMAND, DROP_COMMAND, FOCUS_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, INDENT_CONTENT_COMMAND, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, INSERT_TAB_COMMAND, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_DOWN_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, KEY_MODIFIER_COMMAND, KEY_SPACE_COMMAND, KEY_TAB_COMMAND, MOVE_TO_END, MOVE_TO_START, OUTDENT_CONTENT_COMMAND, PASTE_COMMAND, REDO_COMMAND, REMOVE_TEXT_COMMAND, SELECTION_CHANGE_COMMAND, UNDO_COMMAND, } from './LexicalCommands';
19
19
  export { COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, COMMAND_PRIORITY_NORMAL, createEditor, } from './LexicalEditor';
20
20
  export type { EventHandler } from './LexicalEvents';
21
21
  export { $normalizeSelection as $normalizeSelection__EXPERIMENTAL } from './LexicalNormalization';
22
- export { $createNodeSelection, $createRangeSelection, $getPreviousSelection, $getSelection, $getTextContent, $insertNodes, $isNodeSelection, $isRangeSelection, DEPRECATED_$computeGridMap, DEPRECATED_$createGridSelection, DEPRECATED_$getNodeTriplet, DEPRECATED_$isGridSelection, } from './LexicalSelection';
22
+ export { $createNodeSelection, $createRangeSelection, $getPreviousSelection, $getSelection, $getTextContent, $insertNodes, $isBlockElementNode, $isNodeSelection, $isRangeSelection, DEPRECATED_$computeGridMap, DEPRECATED_$createGridSelection, DEPRECATED_$getNodeTriplet, DEPRECATED_$isGridSelection, } from './LexicalSelection';
23
23
  export { $parseSerializedNode } from './LexicalUpdates';
24
24
  export { $addUpdateTag, $applyNodeReplacement, $copyNode, $getAdjacentNode, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getRoot, $hasAncestor, $hasUpdateTag, $isInlineElementOrDecoratorNode, $isLeafNode, $isRootOrShadowRoot, $nodesOfType, $setCompositionKey, $setSelection, $splitNode, getNearestEditorFromDOMNode, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, } from './LexicalUtils';
25
25
  export { $isDecoratorNode, DecoratorNode } from './nodes/LexicalDecoratorNode';
@@ -32,4 +32,6 @@ export { $createLineBreakNode, $isLineBreakNode, LineBreakNode, } from './nodes/
32
32
  export type { SerializedParagraphNode } from './nodes/LexicalParagraphNode';
33
33
  export { $createParagraphNode, $isParagraphNode, ParagraphNode, } from './nodes/LexicalParagraphNode';
34
34
  export { $isRootNode, RootNode } from './nodes/LexicalRootNode';
35
+ export type { SerializedTabNode } from './nodes/LexicalTabNode';
36
+ export { $createTabNode, $isTabNode, TabNode } from './nodes/LexicalTabNode';
35
37
  export { $createTextNode, $isTextNode, TextNode } from './nodes/LexicalTextNode';
@@ -65,7 +65,6 @@ export declare class ElementNode extends LexicalNode {
65
65
  splice(start: number, deleteCount: number, nodesToInsert: Array<LexicalNode>): this;
66
66
  exportJSON(): SerializedElementNode;
67
67
  insertNewAfter(selection: RangeSelection, restoreSelection?: boolean): null | LexicalNode;
68
- canInsertTab(): boolean;
69
68
  canIndent(): boolean;
70
69
  collapseAtStart(selection: RangeSelection): boolean;
71
70
  excludeFromCopy(destination?: 'clone' | 'html'): boolean;
@@ -8,8 +8,8 @@
8
8
  import type { LexicalNode, NodeKey, SerializedElementNode, Spread } from 'lexical';
9
9
  import { ElementNode } from './LexicalElementNode';
10
10
  export declare type SerializedGridCellNode = Spread<{
11
- colSpan: number;
12
- rowSpan: number;
11
+ colSpan?: number;
12
+ rowSpan?: number;
13
13
  }, SerializedElementNode>;
14
14
  /** @noInheritDoc */
15
15
  export declare class DEPRECATED_GridCellNode extends ElementNode {
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { DOMConversionMap, NodeKey } from '../LexicalNode';
9
+ import { LexicalNode } from '../LexicalNode';
10
+ import { SerializedTextNode, TextDetailType, TextModeType, TextNode } from './LexicalTextNode';
11
+ export declare type SerializedTabNode = SerializedTextNode;
12
+ /** @noInheritDoc */
13
+ export declare class TabNode extends TextNode {
14
+ static getType(): string;
15
+ static clone(node: TabNode): TabNode;
16
+ constructor(key?: NodeKey);
17
+ static importDOM(): DOMConversionMap | null;
18
+ static importJSON(serializedTabNode: SerializedTabNode): TabNode;
19
+ exportJSON(): SerializedTabNode;
20
+ setTextContent(_text: string): this;
21
+ setDetail(_detail: TextDetailType | number): this;
22
+ setMode(_type: TextModeType): this;
23
+ canInsertTextBefore(): boolean;
24
+ canInsertTextAfter(): boolean;
25
+ }
26
+ export declare function $createTabNode(): TabNode;
27
+ export declare function $isTabNode(node: LexicalNode | null | undefined): node is TabNode;
@@ -71,10 +71,10 @@ export declare class TextNode extends LexicalNode {
71
71
  spliceText(offset: number, delCount: number, newText: string, moveSelection?: boolean): TextNode;
72
72
  canInsertTextBefore(): boolean;
73
73
  canInsertTextAfter(): boolean;
74
- canContainTabs(): boolean;
75
74
  splitText(...splitOffsets: Array<number>): Array<TextNode>;
76
75
  mergeWithSibling(target: TextNode): TextNode;
77
76
  isTextEntity(): boolean;
78
77
  }
78
+ export declare function findParentPreDOMNode(node: Node): Node | null;
79
79
  export declare function $createTextNode(text?: string): TextNode;
80
80
  export declare function $isTextNode(node: LexicalNode | null | undefined): node is TextNode;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "rich-text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.9.2",
12
+ "version": "0.11.0",
13
13
  "main": "Lexical.js",
14
14
  "repository": {
15
15
  "type": "git",