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.dev.js +917 -2803
- package/Lexical.js.flow +19 -9
- package/Lexical.prod.js +191 -194
- package/LexicalEditor.d.ts +15 -8
- package/LexicalSelection.d.ts +7 -9
- package/index.d.ts +1 -1
- package/package.json +1 -1
package/LexicalEditor.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import type { EditorState, SerializedEditorState } from './LexicalEditorState';
|
|
9
|
-
import type { DOMConversion, NodeKey } from './LexicalNode';
|
|
9
|
+
import type { DOMConversion, DOMConversionMap, DOMExportOutput, NodeKey } from './LexicalNode';
|
|
10
10
|
import { LexicalNode } from './LexicalNode';
|
|
11
11
|
export type Spread<T1, T2> = Omit<T2, keyof T1> & T1;
|
|
12
12
|
export type Klass<T extends LexicalNode> = {
|
|
@@ -101,21 +101,27 @@ export type EditorConfig = {
|
|
|
101
101
|
namespace: string;
|
|
102
102
|
theme: EditorThemeClasses;
|
|
103
103
|
};
|
|
104
|
+
export type LexicalNodeReplacement = {
|
|
105
|
+
replace: Klass<LexicalNode>;
|
|
106
|
+
with: <T extends {
|
|
107
|
+
new (...args: any): any;
|
|
108
|
+
}>(node: InstanceType<T>) => LexicalNode;
|
|
109
|
+
withKlass?: Klass<LexicalNode>;
|
|
110
|
+
};
|
|
111
|
+
export type HTMLConfig = {
|
|
112
|
+
export?: Map<Klass<LexicalNode>, (editor: LexicalEditor, target: LexicalNode) => DOMExportOutput>;
|
|
113
|
+
import?: DOMConversionMap;
|
|
114
|
+
};
|
|
104
115
|
export type CreateEditorArgs = {
|
|
105
116
|
disableEvents?: boolean;
|
|
106
117
|
editorState?: EditorState;
|
|
107
118
|
namespace?: string;
|
|
108
|
-
nodes?: ReadonlyArray<Klass<LexicalNode> |
|
|
109
|
-
replace: Klass<LexicalNode>;
|
|
110
|
-
with: <T extends {
|
|
111
|
-
new (...args: any): any;
|
|
112
|
-
}>(node: InstanceType<T>) => LexicalNode;
|
|
113
|
-
withKlass?: Klass<LexicalNode>;
|
|
114
|
-
}>;
|
|
119
|
+
nodes?: ReadonlyArray<Klass<LexicalNode> | LexicalNodeReplacement>;
|
|
115
120
|
onError?: ErrorHandler;
|
|
116
121
|
parentEditor?: LexicalEditor;
|
|
117
122
|
editable?: boolean;
|
|
118
123
|
theme?: EditorThemeClasses;
|
|
124
|
+
html?: HTMLConfig;
|
|
119
125
|
};
|
|
120
126
|
export type RegisteredNodes = Map<string, RegisteredNode>;
|
|
121
127
|
export type RegisteredNode = {
|
|
@@ -123,6 +129,7 @@ export type RegisteredNode = {
|
|
|
123
129
|
transforms: Set<Transform<LexicalNode>>;
|
|
124
130
|
replace: null | ((node: LexicalNode) => LexicalNode);
|
|
125
131
|
replaceWithKlass: null | Klass<LexicalNode>;
|
|
132
|
+
exportDOM?: (editor: LexicalEditor, targetNode: LexicalNode) => DOMExportOutput;
|
|
126
133
|
};
|
|
127
134
|
export type Transform<T extends LexicalNode> = (node: T) => void;
|
|
128
135
|
export type ErrorHandler = (error: Error) => void;
|
package/LexicalSelection.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ export declare class NodeSelection implements BaseSelection {
|
|
|
74
74
|
extract(): Array<LexicalNode>;
|
|
75
75
|
insertRawText(text: string): void;
|
|
76
76
|
insertText(): void;
|
|
77
|
-
insertNodes(nodes: Array<LexicalNode
|
|
77
|
+
insertNodes(nodes: Array<LexicalNode>): void;
|
|
78
78
|
getNodes(): Array<LexicalNode>;
|
|
79
79
|
getTextContent(): string;
|
|
80
80
|
}
|
|
@@ -107,7 +107,7 @@ export declare class GridSelection implements BaseSelection {
|
|
|
107
107
|
extract(): Array<LexicalNode>;
|
|
108
108
|
insertRawText(text: string): void;
|
|
109
109
|
insertText(): void;
|
|
110
|
-
insertNodes(nodes: Array<LexicalNode
|
|
110
|
+
insertNodes(nodes: Array<LexicalNode>): void;
|
|
111
111
|
getShape(): GridSelectionShape;
|
|
112
112
|
getNodes(): Array<LexicalNode>;
|
|
113
113
|
getTextContent(): string;
|
|
@@ -227,19 +227,17 @@ export declare class RangeSelection implements BaseSelection {
|
|
|
227
227
|
* should be changed, replaced, or moved to accomodate the incoming ones.
|
|
228
228
|
*
|
|
229
229
|
* @param nodes - the nodes to insert
|
|
230
|
-
* @param selectStart - whether or not to select the start after the insertion.
|
|
231
|
-
* @returns true if the nodes were inserted successfully, false otherwise.
|
|
232
230
|
*/
|
|
233
|
-
insertNodes(nodes: Array<LexicalNode
|
|
231
|
+
insertNodes(nodes: Array<LexicalNode>): void;
|
|
234
232
|
/**
|
|
235
233
|
* Inserts a new ParagraphNode into the EditorState at the current Selection
|
|
234
|
+
*
|
|
235
|
+
* @returns the newly inserted node.
|
|
236
236
|
*/
|
|
237
|
-
insertParagraph():
|
|
237
|
+
insertParagraph(): ElementNode | null;
|
|
238
238
|
/**
|
|
239
239
|
* Inserts a logical linebreak, which may be a new LineBreakNode or a new ParagraphNode, into the EditorState at the
|
|
240
240
|
* current Selection.
|
|
241
|
-
*
|
|
242
|
-
* @param selectStart whether or not to select the start of the insertion range after the operation completes.
|
|
243
241
|
*/
|
|
244
242
|
insertLineBreak(selectStart?: boolean): void;
|
|
245
243
|
/**
|
|
@@ -303,7 +301,7 @@ export declare function applySelectionTransforms(nextEditorState: EditorState, e
|
|
|
303
301
|
export declare function moveSelectionPointToSibling(point: PointType, node: LexicalNode, parent: ElementNode, prevSibling: LexicalNode | null, nextSibling: LexicalNode | null): void;
|
|
304
302
|
export declare function adjustPointOffsetForMergedSibling(point: PointType, isBefore: boolean, key: NodeKey, target: TextNode, textLength: number): void;
|
|
305
303
|
export declare function updateDOMSelection(prevSelection: RangeSelection | NodeSelection | GridSelection | null, nextSelection: RangeSelection | NodeSelection | GridSelection | null, editor: LexicalEditor, domSelection: Selection, tags: Set<string>, rootElement: HTMLElement, nodeCount: number): void;
|
|
306
|
-
export declare function $insertNodes(nodes: Array<LexicalNode
|
|
304
|
+
export declare function $insertNodes(nodes: Array<LexicalNode>): void;
|
|
307
305
|
export declare function $getTextContent(): string;
|
|
308
306
|
export declare function DEPRECATED_$computeGridMap(grid: DEPRECATED_GridNode, cellA: DEPRECATED_GridCellNode, cellB: DEPRECATED_GridCellNode): [GridMapType, GridMapValueType, GridMapValueType];
|
|
309
307
|
export declare function DEPRECATED_$getNodeTriplet(source: PointType | LexicalNode | DEPRECATED_GridCellNode): [DEPRECATED_GridCellNode, DEPRECATED_GridRowNode, DEPRECATED_GridNode];
|
package/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
export type { PasteCommandType } from './LexicalCommands';
|
|
10
|
-
export type { CommandListener, CommandListenerPriority, CommandPayloadType, CreateEditorArgs, EditableListener, EditorConfig, EditorThemeClasses, Klass, LexicalCommand, LexicalEditor, MutationListener, NodeMutation, SerializedEditor, Spread, } from './LexicalEditor';
|
|
10
|
+
export type { CommandListener, CommandListenerPriority, CommandPayloadType, CreateEditorArgs, EditableListener, EditorConfig, EditorThemeClasses, HTMLConfig, Klass, LexicalCommand, LexicalEditor, LexicalNodeReplacement, 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, GridMapType, GridMapValueType, GridSelection, GridSelectionShape, NodeSelection, Point, RangeSelection, TextPointType as TextPoint, } from './LexicalSelection';
|