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.dev.js +682 -369
- package/Lexical.js.flow +22 -9
- package/Lexical.prod.js +187 -180
- package/LexicalConstants.d.ts +2 -0
- package/LexicalEditor.d.ts +3 -1
- package/LexicalGC.d.ts +3 -1
- package/LexicalNode.d.ts +3 -4
- package/LexicalReconciler.d.ts +3 -1
- package/LexicalSelection.d.ts +1 -1
- package/LexicalUtils.d.ts +5 -2
- package/LexicalVersion.d.ts +1 -1
- package/index.d.ts +2 -2
- package/nodes/LexicalElementNode.d.ts +2 -4
- package/nodes/LexicalLineBreakNode.d.ts +1 -1
- package/nodes/LexicalParagraphNode.d.ts +3 -3
- package/nodes/LexicalTextNode.d.ts +4 -0
- package/package.json +1 -1
package/LexicalConstants.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export declare const IS_ALIGN_LEFT = 1;
|
|
|
29
29
|
export declare const IS_ALIGN_CENTER = 2;
|
|
30
30
|
export declare const IS_ALIGN_RIGHT = 3;
|
|
31
31
|
export declare const IS_ALIGN_JUSTIFY = 4;
|
|
32
|
+
export declare const IS_ALIGN_START = 5;
|
|
33
|
+
export declare const IS_ALIGN_END = 6;
|
|
32
34
|
export declare const NON_BREAKING_SPACE = "\u00A0";
|
|
33
35
|
export declare const COMPOSITION_SUFFIX: string;
|
|
34
36
|
export declare const DOUBLE_LINE_BREAK = "\n\n";
|
package/LexicalEditor.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export declare type EditorFocusOptions = {
|
|
|
37
37
|
defaultSelection?: 'rootStart' | 'rootEnd';
|
|
38
38
|
};
|
|
39
39
|
export declare type EditorThemeClasses = {
|
|
40
|
+
blockCursor?: EditorThemeClassName;
|
|
40
41
|
characterLimit?: EditorThemeClassName;
|
|
41
42
|
code?: EditorThemeClassName;
|
|
42
43
|
codeHighlight?: Record<string, EditorThemeClassName>;
|
|
@@ -168,7 +169,7 @@ declare type Listeners = {
|
|
|
168
169
|
export declare type Listener = DecoratorListener | EditableListener | MutationListener | RootListener | TextContentListener | UpdateListener;
|
|
169
170
|
export declare type ListenerType = 'update' | 'root' | 'decorator' | 'textcontent' | 'mutation' | 'editable';
|
|
170
171
|
export declare type TransformerType = 'text' | 'decorator' | 'element' | 'root';
|
|
171
|
-
|
|
172
|
+
declare type IntentionallyMarkedAsDirtyElement = boolean;
|
|
172
173
|
declare type DOMConversionCache = Map<string, Array<(node: Node) => DOMConversion | null>>;
|
|
173
174
|
export declare type SerializedEditor = {
|
|
174
175
|
editorState: SerializedEditorState;
|
|
@@ -218,6 +219,7 @@ export declare class LexicalEditor {
|
|
|
218
219
|
_htmlConversions: DOMConversionCache;
|
|
219
220
|
_window: null | Window;
|
|
220
221
|
_editable: boolean;
|
|
222
|
+
_blockCursorElement: null | HTMLDivElement;
|
|
221
223
|
constructor(editorState: EditorState, parentEditor: null | LexicalEditor, nodes: RegisteredNodes, config: EditorConfig, onError: ErrorHandler, htmlConversions: DOMConversionCache, editable: boolean);
|
|
222
224
|
isComposing(): boolean;
|
|
223
225
|
registerUpdateListener(listener: UpdateListener): () => void;
|
package/LexicalGC.d.ts
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { LexicalEditor } from './LexicalEditor';
|
|
9
9
|
import type { EditorState } from './LexicalEditorState';
|
|
10
10
|
import type { NodeKey } from './LexicalNode';
|
|
11
11
|
export declare function $garbageCollectDetachedDecorators(editor: LexicalEditor, pendingEditorState: EditorState): void;
|
|
12
|
+
declare type IntentionallyMarkedAsDirtyElement = boolean;
|
|
12
13
|
export declare function $garbageCollectDetachedNodes(prevEditorState: EditorState, editorState: EditorState, dirtyLeaves: Set<NodeKey>, dirtyElements: Map<NodeKey, IntentionallyMarkedAsDirtyElement>): void;
|
|
14
|
+
export {};
|
package/LexicalNode.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export declare type SerializedLexicalNode = {
|
|
|
14
14
|
version: number;
|
|
15
15
|
};
|
|
16
16
|
export declare function removeNode(nodeToRemove: LexicalNode, restoreSelection: boolean, preserveEmptyParent?: boolean): void;
|
|
17
|
-
export declare function $getNodeByKeyOrThrow<N extends LexicalNode>(key: NodeKey): N;
|
|
18
17
|
export declare type DOMConversion<T extends HTMLElement = HTMLElement> = {
|
|
19
18
|
conversion: DOMConversionFn<T>;
|
|
20
19
|
priority: 0 | 1 | 2 | 3 | 4;
|
|
@@ -80,9 +79,9 @@ export declare class LexicalNode {
|
|
|
80
79
|
exportJSON(): SerializedLexicalNode;
|
|
81
80
|
static importJSON(_serializedNode: SerializedLexicalNode): LexicalNode;
|
|
82
81
|
remove(preserveEmptyParent?: boolean): void;
|
|
83
|
-
replace<N extends LexicalNode>(replaceWith: N): N;
|
|
84
|
-
insertAfter(nodeToInsert: LexicalNode): LexicalNode;
|
|
85
|
-
insertBefore(nodeToInsert: LexicalNode): LexicalNode;
|
|
82
|
+
replace<N extends LexicalNode>(replaceWith: N, restoreSelection?: boolean): N;
|
|
83
|
+
insertAfter(nodeToInsert: LexicalNode, restoreSelection?: boolean): LexicalNode;
|
|
84
|
+
insertBefore(nodeToInsert: LexicalNode, restoreSelection?: boolean): LexicalNode;
|
|
86
85
|
selectPrevious(anchorOffset?: number, focusOffset?: number): RangeSelection;
|
|
87
86
|
selectNext(anchorOffset?: number, focusOffset?: number): RangeSelection;
|
|
88
87
|
markDirty(): void;
|
package/LexicalReconciler.d.ts
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { LexicalEditor, MutatedNodes } from './LexicalEditor';
|
|
9
9
|
import type { NodeKey } from './LexicalNode';
|
|
10
10
|
import { EditorState } from './LexicalEditorState';
|
|
11
|
+
declare type IntentionallyMarkedAsDirtyElement = boolean;
|
|
11
12
|
export declare function reconcileRoot(prevEditorState: EditorState, nextEditorState: EditorState, editor: LexicalEditor, dirtyType: 0 | 1 | 2, dirtyElements: Map<NodeKey, IntentionallyMarkedAsDirtyElement>, dirtyLeaves: Set<NodeKey>): MutatedNodes;
|
|
12
13
|
export declare function storeDOMWithKey(key: NodeKey, dom: HTMLElement, editor: LexicalEditor): void;
|
|
14
|
+
export {};
|
package/LexicalSelection.d.ts
CHANGED
|
@@ -144,6 +144,6 @@ export declare function $updateElementSelectionOnCreateDeleteNode(selection: Ran
|
|
|
144
144
|
export declare function applySelectionTransforms(nextEditorState: EditorState, editor: LexicalEditor): void;
|
|
145
145
|
export declare function moveSelectionPointToSibling(point: PointType, node: LexicalNode, parent: ElementNode, prevSibling: LexicalNode | null, nextSibling: LexicalNode | null): void;
|
|
146
146
|
export declare function adjustPointOffsetForMergedSibling(point: PointType, isBefore: boolean, key: NodeKey, target: TextNode, textLength: number): void;
|
|
147
|
-
export declare function updateDOMSelection(prevSelection: RangeSelection | NodeSelection | GridSelection | null, nextSelection: RangeSelection | NodeSelection | GridSelection | null, editor: LexicalEditor, domSelection: Selection, tags: Set<string>, rootElement: HTMLElement): void;
|
|
147
|
+
export declare function updateDOMSelection(prevSelection: RangeSelection | NodeSelection | GridSelection | null, nextSelection: RangeSelection | NodeSelection | GridSelection | null, editor: LexicalEditor, domSelection: Selection, tags: Set<string>, rootElement: HTMLElement, dirtyLeavesCount: number): void;
|
|
148
148
|
export declare function $insertNodes(nodes: Array<LexicalNode>, selectStart?: boolean): boolean;
|
|
149
149
|
export declare function $getTextContent(): string;
|
package/LexicalUtils.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare function getDOMTextNode(element: Node | null): Text | null;
|
|
|
29
29
|
export declare function toggleTextFormatType(format: number, type: TextFormatType, alignWithFormat: null | number): number;
|
|
30
30
|
export declare function $isLeafNode(node: LexicalNode | null | undefined): node is TextNode | LineBreakNode | DecoratorNode<unknown>;
|
|
31
31
|
export declare function $setNodeKey(node: LexicalNode, existingKey: NodeKey | null | undefined): void;
|
|
32
|
-
export declare function removeFromParent(
|
|
32
|
+
export declare function removeFromParent(node: LexicalNode): void;
|
|
33
33
|
export declare function internalMarkNodeAsDirty(node: LexicalNode): void;
|
|
34
34
|
export declare function internalMarkSiblingsAsDirty(node: LexicalNode): void;
|
|
35
35
|
export declare function $setCompositionKey(compositionKey: null | NodeKey): void;
|
|
@@ -86,7 +86,7 @@ export declare function isDelete(keyCode: number): boolean;
|
|
|
86
86
|
export declare function getCachedClassNameArray(classNamesTheme: EditorThemeClasses, classNameThemeType: string): Array<string>;
|
|
87
87
|
export declare function setMutatedNode(mutatedNodes: MutatedNodes, registeredNodes: RegisteredNodes, mutationListeners: MutationListeners, node: LexicalNode, mutation: NodeMutation): void;
|
|
88
88
|
export declare function $nodesOfType<T extends LexicalNode>(klass: Klass<T>): Array<T>;
|
|
89
|
-
export declare function $
|
|
89
|
+
export declare function $getAdjacentNode(focus: PointType, isBackward: boolean): null | LexicalNode;
|
|
90
90
|
export declare function isFirefoxClipboardEvents(editor: LexicalEditor): boolean;
|
|
91
91
|
export declare function dispatchCommand<TCommand extends LexicalCommand<unknown>>(editor: LexicalEditor, command: TCommand, payload: CommandPayloadType<TCommand>): boolean;
|
|
92
92
|
export declare function $textContentRequiresDoubleLinebreakAtEnd(node: ElementNode): boolean;
|
|
@@ -105,3 +105,6 @@ export declare function $isRootOrShadowRoot(node: null | LexicalNode): boolean;
|
|
|
105
105
|
export declare function $copyNode<T extends LexicalNode>(node: T): T;
|
|
106
106
|
export declare function $applyNodeReplacement<N extends LexicalNode>(node: LexicalNode): N;
|
|
107
107
|
export declare function errorOnInsertTextNodeOnRoot(node: LexicalNode, insertNode: LexicalNode): void;
|
|
108
|
+
export declare function $getNodeByKeyOrThrow<N extends LexicalNode>(key: NodeKey): N;
|
|
109
|
+
export declare function removeDOMBlockCursorElement(blockCursorElement: HTMLElement, editor: LexicalEditor, rootElement: HTMLElement): void;
|
|
110
|
+
export declare function updateDOMBlockCursorElement(editor: LexicalEditor, rootElement: HTMLElement, nextSelection: null | RangeSelection | NodeSelection | GridSelection): void;
|
package/LexicalVersion.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
export type { PasteCommandType } from './LexicalCommands';
|
|
10
|
-
export type { CommandListenerPriority, CommandPayloadType, EditableListener, EditorConfig, EditorThemeClasses,
|
|
10
|
+
export type { CommandListenerPriority, CommandPayloadType, EditableListener, EditorConfig, EditorThemeClasses, Klass, LexicalCommand, LexicalEditor, MutationListener, NodeMutation, SerializedEditor, Spread, } from './LexicalEditor';
|
|
11
11
|
export type { EditorState, SerializedEditorState } from './LexicalEditorState';
|
|
12
12
|
export type { DOMChildConversion, DOMConversion, DOMConversionFn, DOMConversionMap, DOMConversionOutput, DOMExportOutput, LexicalNode, NodeKey, NodeMap, SerializedLexicalNode, } from './LexicalNode';
|
|
13
13
|
export type { BaseSelection, ElementPointType as ElementPoint, GridSelection, GridSelectionShape, NodeSelection, Point, RangeSelection, TextPointType as TextPoint, } from './LexicalSelection';
|
|
@@ -21,7 +21,7 @@ export type { EventHandler } from './LexicalEvents';
|
|
|
21
21
|
export { $normalizeSelection as $normalizeSelection__EXPERIMENTAL } from './LexicalNormalization';
|
|
22
22
|
export { $createNodeSelection, $createRangeSelection, $getPreviousSelection, $getSelection, $getTextContent, $insertNodes, $isNodeSelection, $isRangeSelection, DEPRECATED_$createGridSelection, DEPRECATED_$isGridSelection, } from './LexicalSelection';
|
|
23
23
|
export { $parseSerializedNode } from './LexicalUpdates';
|
|
24
|
-
export { $addUpdateTag, $applyNodeReplacement, $copyNode, $
|
|
24
|
+
export { $addUpdateTag, $applyNodeReplacement, $copyNode, $getAdjacentNode, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getRoot, $hasAncestor, $isInlineElementOrDecoratorNode, $isLeafNode, $isRootOrShadowRoot, $nodesOfType, $setCompositionKey, $setSelection, } from './LexicalUtils';
|
|
25
25
|
export { VERSION } from './LexicalVersion';
|
|
26
26
|
export { $isDecoratorNode, DecoratorNode } from './nodes/LexicalDecoratorNode';
|
|
27
27
|
export { $isElementNode, ElementNode } from './nodes/LexicalElementNode';
|
|
@@ -16,11 +16,9 @@ export declare type SerializedElementNode = Spread<{
|
|
|
16
16
|
format: ElementFormatType;
|
|
17
17
|
indent: number;
|
|
18
18
|
}, SerializedLexicalNode>;
|
|
19
|
-
export declare type ElementFormatType = 'left' | 'center' | 'right' | 'justify' | '';
|
|
19
|
+
export declare type ElementFormatType = 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
|
20
20
|
/** @noInheritDoc */
|
|
21
21
|
export declare class ElementNode extends LexicalNode {
|
|
22
|
-
/** @internal */
|
|
23
|
-
__children: Array<NodeKey>;
|
|
24
22
|
/** @internal */
|
|
25
23
|
__first: null | NodeKey;
|
|
26
24
|
/** @internal */
|
|
@@ -65,7 +63,7 @@ export declare class ElementNode extends LexicalNode {
|
|
|
65
63
|
setIndent(indentLevel: number): this;
|
|
66
64
|
splice(start: number, deleteCount: number, nodesToInsert: Array<LexicalNode>): this;
|
|
67
65
|
exportJSON(): SerializedElementNode;
|
|
68
|
-
insertNewAfter(selection: RangeSelection): null | LexicalNode;
|
|
66
|
+
insertNewAfter(selection: RangeSelection, restoreSelection?: boolean): null | LexicalNode;
|
|
69
67
|
canInsertTab(): boolean;
|
|
70
68
|
canIndent(): boolean;
|
|
71
69
|
collapseAtStart(selection: RangeSelection): boolean;
|
|
@@ -21,7 +21,7 @@ export declare class LineBreakNode extends LexicalNode {
|
|
|
21
21
|
updateDOM(): false;
|
|
22
22
|
static importDOM(): DOMConversionMap | null;
|
|
23
23
|
static importJSON(serializedLineBreakNode: SerializedLineBreakNode): LineBreakNode;
|
|
24
|
-
exportJSON():
|
|
24
|
+
exportJSON(): SerializedLexicalNode;
|
|
25
25
|
}
|
|
26
26
|
export declare function $createLineBreakNode(): LineBreakNode;
|
|
27
27
|
export declare function $isLineBreakNode(node: LexicalNode | null | undefined): node is LineBreakNode;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import type { EditorConfig, LexicalEditor } from '../LexicalEditor';
|
|
9
9
|
import type { DOMConversionMap, DOMExportOutput, LexicalNode } from '../LexicalNode';
|
|
10
10
|
import type { SerializedElementNode } from './LexicalElementNode';
|
|
11
|
-
import type { Spread } from 'lexical';
|
|
11
|
+
import type { RangeSelection, Spread } from 'lexical';
|
|
12
12
|
import { ElementNode } from './LexicalElementNode';
|
|
13
13
|
export declare type SerializedParagraphNode = Spread<{
|
|
14
14
|
type: 'paragraph';
|
|
@@ -23,8 +23,8 @@ export declare class ParagraphNode extends ElementNode {
|
|
|
23
23
|
static importDOM(): DOMConversionMap | null;
|
|
24
24
|
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
|
25
25
|
static importJSON(serializedNode: SerializedParagraphNode): ParagraphNode;
|
|
26
|
-
exportJSON():
|
|
27
|
-
insertNewAfter(): ParagraphNode;
|
|
26
|
+
exportJSON(): SerializedElementNode;
|
|
27
|
+
insertNewAfter(_: RangeSelection, restoreSelection: boolean): ParagraphNode;
|
|
28
28
|
collapseAtStart(): boolean;
|
|
29
29
|
}
|
|
30
30
|
export declare function $createParagraphNode(): ParagraphNode;
|
|
@@ -29,9 +29,13 @@ export declare type TextMarks = Array<TextMark>;
|
|
|
29
29
|
/** @noInheritDoc */
|
|
30
30
|
export declare class TextNode extends LexicalNode {
|
|
31
31
|
__text: string;
|
|
32
|
+
/** @internal */
|
|
32
33
|
__format: number;
|
|
34
|
+
/** @internal */
|
|
33
35
|
__style: string;
|
|
36
|
+
/** @internal */
|
|
34
37
|
__mode: 0 | 1 | 2 | 3;
|
|
38
|
+
/** @internal */
|
|
35
39
|
__detail: number;
|
|
36
40
|
static getType(): string;
|
|
37
41
|
static clone(node: TextNode): TextNode;
|