lexical 0.3.5 → 0.3.8
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 +299 -226
- package/Lexical.js.flow +6 -2
- package/Lexical.prod.js +166 -163
- package/LexicalCommands.d.ts +4 -4
- package/LexicalConstants.d.ts +5 -3
- package/LexicalEditor.d.ts +35 -12
- package/LexicalNode.d.ts +7 -7
- package/LexicalSelection.d.ts +6 -6
- package/LexicalUtils.d.ts +7 -8
- package/LexicalVersion.d.ts +1 -1
- package/index.d.ts +1 -1
- package/nodes/LexicalElementNode.d.ts +1 -1
- package/nodes/LexicalTextNode.d.ts +3 -2
- package/package.json +1 -4
package/LexicalCommands.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ export declare const CLICK_COMMAND: LexicalCommand<MouseEvent>;
|
|
|
12
12
|
export declare const DELETE_CHARACTER_COMMAND: LexicalCommand<boolean>;
|
|
13
13
|
export declare const INSERT_LINE_BREAK_COMMAND: LexicalCommand<boolean>;
|
|
14
14
|
export declare const INSERT_PARAGRAPH_COMMAND: LexicalCommand<void>;
|
|
15
|
-
export declare const CONTROLLED_TEXT_INSERTION_COMMAND: LexicalCommand<string>;
|
|
16
|
-
export declare const PASTE_COMMAND: LexicalCommand<ClipboardEvent>;
|
|
15
|
+
export declare const CONTROLLED_TEXT_INSERTION_COMMAND: LexicalCommand<InputEvent | string>;
|
|
16
|
+
export declare const PASTE_COMMAND: LexicalCommand<ClipboardEvent | InputEvent>;
|
|
17
17
|
export declare const REMOVE_TEXT_COMMAND: LexicalCommand<void>;
|
|
18
18
|
export declare const DELETE_WORD_COMMAND: LexicalCommand<boolean>;
|
|
19
19
|
export declare const DELETE_LINE_COMMAND: LexicalCommand<boolean>;
|
|
@@ -39,8 +39,8 @@ export declare const FORMAT_ELEMENT_COMMAND: LexicalCommand<ElementFormatType>;
|
|
|
39
39
|
export declare const DRAGSTART_COMMAND: LexicalCommand<DragEvent>;
|
|
40
40
|
export declare const DRAGOVER_COMMAND: LexicalCommand<DragEvent>;
|
|
41
41
|
export declare const DRAGEND_COMMAND: LexicalCommand<DragEvent>;
|
|
42
|
-
export declare const COPY_COMMAND: LexicalCommand<ClipboardEvent>;
|
|
43
|
-
export declare const CUT_COMMAND: LexicalCommand<ClipboardEvent>;
|
|
42
|
+
export declare const COPY_COMMAND: LexicalCommand<ClipboardEvent | KeyboardEvent>;
|
|
43
|
+
export declare const CUT_COMMAND: LexicalCommand<ClipboardEvent | KeyboardEvent>;
|
|
44
44
|
export declare const CLEAR_EDITOR_COMMAND: LexicalCommand<void>;
|
|
45
45
|
export declare const CLEAR_HISTORY_COMMAND: LexicalCommand<void>;
|
|
46
46
|
export declare const CAN_REDO_COMMAND: LexicalCommand<boolean>;
|
package/LexicalConstants.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import type { ElementFormatType } from './nodes/LexicalElementNode';
|
|
9
|
-
import type { TextFormatType, TextModeType } from './nodes/LexicalTextNode';
|
|
9
|
+
import type { TextDetailType, TextFormatType, TextModeType } from './nodes/LexicalTextNode';
|
|
10
10
|
export declare const DOM_ELEMENT_TYPE = 1;
|
|
11
11
|
export declare const DOM_TEXT_TYPE = 3;
|
|
12
12
|
export declare const NO_DIRTY_NODES = 0;
|
|
@@ -23,6 +23,7 @@ export declare const IS_UNDERLINE: number;
|
|
|
23
23
|
export declare const IS_CODE: number;
|
|
24
24
|
export declare const IS_SUBSCRIPT: number;
|
|
25
25
|
export declare const IS_SUPERSCRIPT: number;
|
|
26
|
+
export declare const IS_ALL_FORMATTING: number;
|
|
26
27
|
export declare const IS_DIRECTIONLESS = 1;
|
|
27
28
|
export declare const IS_UNMERGEABLE: number;
|
|
28
29
|
export declare const IS_ALIGN_LEFT = 1;
|
|
@@ -35,8 +36,9 @@ export declare const DOUBLE_LINE_BREAK = "\n\n";
|
|
|
35
36
|
export declare const COMPOSITION_START_CHAR: string;
|
|
36
37
|
export declare const RTL_REGEX: RegExp;
|
|
37
38
|
export declare const LTR_REGEX: RegExp;
|
|
38
|
-
export declare const TEXT_TYPE_TO_FORMAT: Record<TextFormatType, number>;
|
|
39
|
-
export declare const
|
|
39
|
+
export declare const TEXT_TYPE_TO_FORMAT: Record<TextFormatType | string, number>;
|
|
40
|
+
export declare const DETAIL_TYPE_TO_DETAIL: Record<TextDetailType | string, number>;
|
|
41
|
+
export declare const ELEMENT_TYPE_TO_FORMAT: Record<Exclude<ElementFormatType, ''>, number>;
|
|
40
42
|
export declare const ELEMENT_FORMAT_TO_TYPE: Record<number, ElementFormatType>;
|
|
41
43
|
export declare const TEXT_MODE_TO_TYPE: Record<TextModeType, 0 | 1 | 2 | 3>;
|
|
42
44
|
export declare const TEXT_TYPE_TO_MODE: Record<number, TextModeType>;
|
package/LexicalEditor.d.ts
CHANGED
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { EditorState, SerializedEditorState } from './LexicalEditorState';
|
|
9
9
|
import type { DOMConversion, LexicalNode, NodeKey } from './LexicalNode';
|
|
10
|
-
import type { Klass } from 'shared/types';
|
|
11
10
|
export declare type Spread<T1, T2> = Omit<T2, keyof T1> & T1;
|
|
11
|
+
export declare type Klass<T extends LexicalNode> = {
|
|
12
|
+
new (...args: any[]): T;
|
|
13
|
+
} & Omit<LexicalNode, 'constructor'>;
|
|
12
14
|
export declare type EditorThemeClassName = string;
|
|
13
15
|
export declare type TextNodeThemeClasses = {
|
|
14
16
|
base?: EditorThemeClassName;
|
|
@@ -29,7 +31,11 @@ export declare type EditorUpdateOptions = {
|
|
|
29
31
|
export declare type EditorSetOptions = {
|
|
30
32
|
tag?: string;
|
|
31
33
|
};
|
|
34
|
+
export declare type EditorFocusOptions = {
|
|
35
|
+
defaultSelection?: 'rootStart' | 'rootEnd';
|
|
36
|
+
};
|
|
32
37
|
export declare type EditorThemeClasses = {
|
|
38
|
+
characterLimit?: EditorThemeClassName;
|
|
33
39
|
code?: EditorThemeClassName;
|
|
34
40
|
codeHighlight?: Record<string, EditorThemeClassName>;
|
|
35
41
|
hashtag?: EditorThemeClassName;
|
|
@@ -72,11 +78,7 @@ export declare type EditorThemeClasses = {
|
|
|
72
78
|
base?: EditorThemeClassName;
|
|
73
79
|
focus?: EditorThemeClassName;
|
|
74
80
|
};
|
|
75
|
-
[key: string]:
|
|
76
|
-
[key: string]: Array<EditorThemeClassName> | EditorThemeClassName | TextNodeThemeClasses | {
|
|
77
|
-
[key: string]: EditorThemeClassName;
|
|
78
|
-
};
|
|
79
|
-
};
|
|
81
|
+
[key: string]: any;
|
|
80
82
|
};
|
|
81
83
|
export declare type EditorConfig = {
|
|
82
84
|
disableEvents?: boolean;
|
|
@@ -88,7 +90,7 @@ export declare type RegisteredNode = {
|
|
|
88
90
|
klass: Klass<LexicalNode>;
|
|
89
91
|
transforms: Set<Transform<LexicalNode>>;
|
|
90
92
|
};
|
|
91
|
-
export declare type Transform<T> = (node: T) => void;
|
|
93
|
+
export declare type Transform<T extends LexicalNode> = (node: T) => void;
|
|
92
94
|
export declare type ErrorHandler = (error: Error) => void;
|
|
93
95
|
export declare type MutationListeners = Map<MutationListener, Klass<LexicalNode>>;
|
|
94
96
|
export declare type MutatedNodes = Map<Klass<LexicalNode>, Map<NodeKey, NodeMutation>>;
|
|
@@ -101,7 +103,7 @@ export declare type UpdateListener = (arg0: {
|
|
|
101
103
|
prevEditorState: EditorState;
|
|
102
104
|
tags: Set<string>;
|
|
103
105
|
}) => void;
|
|
104
|
-
export declare type DecoratorListener<T =
|
|
106
|
+
export declare type DecoratorListener<T = never> = (decorator: Record<NodeKey, T>) => void;
|
|
105
107
|
export declare type RootListener = (rootElement: null | HTMLElement, prevRootElement: null | HTMLElement) => void;
|
|
106
108
|
export declare type TextContentListener = (text: string) => void;
|
|
107
109
|
export declare type MutationListener = (nodes: Map<NodeKey, NodeMutation>) => void;
|
|
@@ -113,7 +115,28 @@ export declare const COMMAND_PRIORITY_LOW = 1;
|
|
|
113
115
|
export declare const COMMAND_PRIORITY_NORMAL = 2;
|
|
114
116
|
export declare const COMMAND_PRIORITY_HIGH = 3;
|
|
115
117
|
export declare const COMMAND_PRIORITY_CRITICAL = 4;
|
|
116
|
-
export declare type LexicalCommand<
|
|
118
|
+
export declare type LexicalCommand<TPayload> = Record<string, never>;
|
|
119
|
+
/**
|
|
120
|
+
* Type helper for extracting the payload type from a command.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* const MY_COMMAND = createCommand<SomeType>();
|
|
125
|
+
*
|
|
126
|
+
* // ...
|
|
127
|
+
*
|
|
128
|
+
* editor.registerCommand(MY_COMMAND, payload => {
|
|
129
|
+
* // Type of `payload` is inferred here. But lets say we want to extract a function to delegate to
|
|
130
|
+
* handleMyCommand(editor, payload);
|
|
131
|
+
* return true;
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* function handleMyCommand(editor: LexicalEditor, payload: CommandPayloadType<typeof MY_COMMAND>) {
|
|
135
|
+
* // `payload` is of type `SomeType`, extracted from the command.
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export declare type CommandPayloadType<TCommand extends LexicalCommand<unknown>> = TCommand extends LexicalCommand<infer TPayload> ? TPayload : never;
|
|
117
140
|
declare type Commands = Map<LexicalCommand<unknown>, Array<Set<CommandListener<unknown>>>>;
|
|
118
141
|
declare type Listeners = {
|
|
119
142
|
decorator: Set<DecoratorListener>;
|
|
@@ -151,7 +174,7 @@ export declare class LexicalEditor {
|
|
|
151
174
|
_compositionKey: null | NodeKey;
|
|
152
175
|
_deferred: Array<() => void>;
|
|
153
176
|
_keyToDOMMap: Map<NodeKey, HTMLElement>;
|
|
154
|
-
_updates: Array<[() => void, EditorUpdateOptions]>;
|
|
177
|
+
_updates: Array<[() => void, EditorUpdateOptions | undefined]>;
|
|
155
178
|
_updating: boolean;
|
|
156
179
|
_listeners: Listeners;
|
|
157
180
|
_commands: Commands;
|
|
@@ -181,7 +204,7 @@ export declare class LexicalEditor {
|
|
|
181
204
|
registerMutationListener(klass: Klass<LexicalNode>, listener: MutationListener): () => void;
|
|
182
205
|
registerNodeTransform<T extends LexicalNode>(klass: Klass<T>, listener: Transform<T>): () => void;
|
|
183
206
|
hasNodes<T extends Klass<LexicalNode>>(nodes: Array<T>): boolean;
|
|
184
|
-
dispatchCommand<
|
|
207
|
+
dispatchCommand<TCommand extends LexicalCommand<unknown>, TPayload extends CommandPayloadType<TCommand>>(type: TCommand, payload: TPayload): boolean;
|
|
185
208
|
getDecorators<T>(): Record<NodeKey, T>;
|
|
186
209
|
getRootElement(): null | HTMLElement;
|
|
187
210
|
getKey(): string;
|
|
@@ -191,7 +214,7 @@ export declare class LexicalEditor {
|
|
|
191
214
|
setEditorState(editorState: EditorState, options?: EditorSetOptions): void;
|
|
192
215
|
parseEditorState(maybeStringifiedEditorState: string | SerializedEditorState, updateFn?: () => void): EditorState;
|
|
193
216
|
update(updateFn: () => void, options?: EditorUpdateOptions): void;
|
|
194
|
-
focus(callbackFn?: () => void): void;
|
|
217
|
+
focus(callbackFn?: () => void, options?: EditorFocusOptions): void;
|
|
195
218
|
blur(): void;
|
|
196
219
|
isReadOnly(): boolean;
|
|
197
220
|
setReadOnly(readOnly: boolean): void;
|
package/LexicalNode.d.ts
CHANGED
|
@@ -15,13 +15,13 @@ export declare type SerializedLexicalNode = {
|
|
|
15
15
|
};
|
|
16
16
|
export declare function removeNode(nodeToRemove: LexicalNode, restoreSelection: boolean, preserveEmptyParent?: boolean): void;
|
|
17
17
|
export declare function $getNodeByKeyOrThrow<N extends LexicalNode>(key: NodeKey): N;
|
|
18
|
-
export declare type DOMConversion = {
|
|
19
|
-
conversion: DOMConversionFn
|
|
18
|
+
export declare type DOMConversion<T extends HTMLElement = HTMLElement> = {
|
|
19
|
+
conversion: DOMConversionFn<T>;
|
|
20
20
|
priority: 0 | 1 | 2 | 3 | 4;
|
|
21
21
|
};
|
|
22
|
-
export declare type DOMConversionFn = (element:
|
|
23
|
-
export declare type DOMChildConversion = (lexicalNode: LexicalNode, parentLexicalNode: LexicalNode | null) => LexicalNode | null |
|
|
24
|
-
export declare type DOMConversionMap = Record<NodeName, (node:
|
|
22
|
+
export declare type DOMConversionFn<T extends HTMLElement = HTMLElement> = (element: T, parent?: Node) => DOMConversionOutput | null;
|
|
23
|
+
export declare type DOMChildConversion = (lexicalNode: LexicalNode, parentLexicalNode: LexicalNode | null | undefined) => LexicalNode | null | undefined;
|
|
24
|
+
export declare type DOMConversionMap<T extends HTMLElement = HTMLElement> = Record<NodeName, (node: T) => DOMConversion<T> | null>;
|
|
25
25
|
declare type NodeName = string;
|
|
26
26
|
export declare type DOMConversionOutput = {
|
|
27
27
|
after?: (childLexicalNodes: Array<LexicalNode>) => Array<LexicalNode>;
|
|
@@ -36,7 +36,7 @@ export declare type NodeKey = string;
|
|
|
36
36
|
export declare class LexicalNode {
|
|
37
37
|
[x: string]: any;
|
|
38
38
|
__type: string;
|
|
39
|
-
__key:
|
|
39
|
+
__key: string;
|
|
40
40
|
__parent: null | NodeKey;
|
|
41
41
|
static getType(): string;
|
|
42
42
|
static clone(_data: unknown): LexicalNode;
|
|
@@ -50,7 +50,7 @@ export declare class LexicalNode {
|
|
|
50
50
|
getParentOrThrow<T extends ElementNode>(): T;
|
|
51
51
|
getTopLevelElement(): ElementNode | this | null;
|
|
52
52
|
getTopLevelElementOrThrow(): ElementNode | this;
|
|
53
|
-
getParents
|
|
53
|
+
getParents(): Array<ElementNode>;
|
|
54
54
|
getParentKeys(): Array<NodeKey>;
|
|
55
55
|
getPreviousSibling<T extends LexicalNode>(): T | null;
|
|
56
56
|
getPreviousSiblings<T extends LexicalNode>(): Array<T>;
|
package/LexicalSelection.d.ts
CHANGED
|
@@ -14,9 +14,9 @@ import { TextNode } from '.';
|
|
|
14
14
|
export declare type TextPointType = {
|
|
15
15
|
_selection: RangeSelection | GridSelection;
|
|
16
16
|
getNode: () => TextNode;
|
|
17
|
-
is: (
|
|
17
|
+
is: (point: PointType) => boolean;
|
|
18
18
|
isAtNodeEnd: () => boolean;
|
|
19
|
-
isBefore: (
|
|
19
|
+
isBefore: (point: PointType) => boolean;
|
|
20
20
|
key: NodeKey;
|
|
21
21
|
offset: number;
|
|
22
22
|
set: (key: NodeKey, offset: number, type: 'text' | 'element') => void;
|
|
@@ -25,9 +25,9 @@ export declare type TextPointType = {
|
|
|
25
25
|
export declare type ElementPointType = {
|
|
26
26
|
_selection: RangeSelection | GridSelection;
|
|
27
27
|
getNode: () => ElementNode;
|
|
28
|
-
is: (
|
|
28
|
+
is: (point: PointType) => boolean;
|
|
29
29
|
isAtNodeEnd: () => boolean;
|
|
30
|
-
isBefore: (
|
|
30
|
+
isBefore: (point: PointType) => boolean;
|
|
31
31
|
key: NodeKey;
|
|
32
32
|
offset: number;
|
|
33
33
|
set: (key: NodeKey, offset: number, type: 'text' | 'element') => void;
|
|
@@ -38,7 +38,7 @@ export declare class Point {
|
|
|
38
38
|
key: NodeKey;
|
|
39
39
|
offset: number;
|
|
40
40
|
type: 'text' | 'element';
|
|
41
|
-
_selection: RangeSelection | GridSelection;
|
|
41
|
+
_selection: RangeSelection | GridSelection | null;
|
|
42
42
|
constructor(key: NodeKey, offset: number, type: 'text' | 'element');
|
|
43
43
|
is(point: PointType): boolean;
|
|
44
44
|
isBefore(b: PointType): boolean;
|
|
@@ -84,7 +84,7 @@ export declare class GridSelection implements BaseSelection {
|
|
|
84
84
|
anchor: PointType;
|
|
85
85
|
focus: PointType;
|
|
86
86
|
dirty: boolean;
|
|
87
|
-
_cachedNodes: Array<LexicalNode
|
|
87
|
+
_cachedNodes: Array<LexicalNode> | null;
|
|
88
88
|
constructor(gridKey: NodeKey, anchor: PointType, focus: PointType);
|
|
89
89
|
is(selection: null | RangeSelection | NodeSelection | GridSelection): boolean;
|
|
90
90
|
set(gridKey: NodeKey, anchorCellKey: NodeKey, focusCellKey: NodeKey): void;
|
package/LexicalUtils.d.ts
CHANGED
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import type { LexicalCommand, MutatedNodes, MutationListeners, NodeMutation, RegisteredNode, RegisteredNodes } from './LexicalEditor';
|
|
8
|
+
import type { CommandPayloadType, EditorThemeClasses, Klass, LexicalCommand, MutatedNodes, MutationListeners, NodeMutation, RegisteredNode, RegisteredNodes } from './LexicalEditor';
|
|
9
9
|
import type { EditorState } from './LexicalEditorState';
|
|
10
10
|
import type { LexicalNode, NodeKey } from './LexicalNode';
|
|
11
11
|
import type { GridSelection, NodeSelection, PointType, RangeSelection } from './LexicalSelection';
|
|
12
12
|
import type { RootNode } from './nodes/LexicalRootNode';
|
|
13
13
|
import type { TextFormatType, TextNode } from './nodes/LexicalTextNode';
|
|
14
|
-
import
|
|
15
|
-
import { ElementNode } from '.';
|
|
14
|
+
import { DecoratorNode, ElementNode, LineBreakNode } from '.';
|
|
16
15
|
import { LexicalEditor } from './LexicalEditor';
|
|
17
16
|
export declare const emptyFunction: () => void;
|
|
18
17
|
export declare function resetRandomKey(): void;
|
|
@@ -27,7 +26,7 @@ export declare function $isTokenOrInertOrSegmented(node: TextNode): boolean;
|
|
|
27
26
|
export declare function $isTokenOrInert(node: TextNode): boolean;
|
|
28
27
|
export declare function getDOMTextNode(element: Node | null): Text | null;
|
|
29
28
|
export declare function toggleTextFormatType(format: number, type: TextFormatType, alignWithFormat: null | number): number;
|
|
30
|
-
export declare function $isLeafNode(node: LexicalNode | null | undefined):
|
|
29
|
+
export declare function $isLeafNode(node: LexicalNode | null | undefined): node is TextNode | LineBreakNode | DecoratorNode<unknown>;
|
|
31
30
|
export declare function $setNodeKey(node: LexicalNode, existingKey: NodeKey | null | undefined): void;
|
|
32
31
|
export declare function removeFromParent(writableNode: LexicalNode): void;
|
|
33
32
|
export declare function internalMarkNodeAsDirty(node: LexicalNode): void;
|
|
@@ -38,7 +37,7 @@ export declare function $getNodeByKey<T extends LexicalNode>(key: NodeKey, _edit
|
|
|
38
37
|
export declare function getNodeFromDOMNode(dom: Node, editorState?: EditorState): LexicalNode | null;
|
|
39
38
|
export declare function $getNearestNodeFromDOMNode(startingDOM: Node, editorState?: EditorState): LexicalNode | null;
|
|
40
39
|
export declare function cloneDecorators(editor: LexicalEditor): Record<NodeKey, unknown>;
|
|
41
|
-
export declare function getEditorStateTextContent(editorState:
|
|
40
|
+
export declare function getEditorStateTextContent(editorState: EditorState): string;
|
|
42
41
|
export declare function markAllNodesAsDirty(editor: LexicalEditor, type: string): void;
|
|
43
42
|
export declare function $getRoot(): RootNode;
|
|
44
43
|
export declare function internalGetRoot(editorState: EditorState): RootNode;
|
|
@@ -82,12 +81,12 @@ export declare function isReturn(keyCode: number): boolean;
|
|
|
82
81
|
export declare function isBackspace(keyCode: number): boolean;
|
|
83
82
|
export declare function isEscape(keyCode: number): boolean;
|
|
84
83
|
export declare function isDelete(keyCode: number): boolean;
|
|
85
|
-
export declare function getCachedClassNameArray
|
|
84
|
+
export declare function getCachedClassNameArray(classNamesTheme: EditorThemeClasses, classNameThemeType: string): Array<string>;
|
|
86
85
|
export declare function setMutatedNode(mutatedNodes: MutatedNodes, registeredNodes: RegisteredNodes, mutationListeners: MutationListeners, node: LexicalNode, mutation: NodeMutation): void;
|
|
87
|
-
export declare function $nodesOfType<T extends LexicalNode>(klass: Klass<T>): Array<
|
|
86
|
+
export declare function $nodesOfType<T extends LexicalNode>(klass: Klass<T>): Array<LexicalNode>;
|
|
88
87
|
export declare function $getDecoratorNode(focus: PointType, isBackward: boolean): null | LexicalNode;
|
|
89
88
|
export declare function isFirefoxClipboardEvents(): boolean;
|
|
90
|
-
export declare function dispatchCommand<
|
|
89
|
+
export declare function dispatchCommand<TCommand extends LexicalCommand<unknown>, TPayload extends CommandPayloadType<TCommand>>(editor: LexicalEditor, type: TCommand, payload: TPayload): boolean;
|
|
91
90
|
export declare function $textContentRequiresDoubleLinebreakAtEnd(node: ElementNode): boolean;
|
|
92
91
|
export declare function getElementByKeyOrThrow(editor: LexicalEditor, key: NodeKey): HTMLElement;
|
|
93
92
|
export declare function scrollIntoViewIfNeeded(editor: LexicalEditor, anchor: PointType, rootElement: HTMLElement, tags: Set<string>): void;
|
package/LexicalVersion.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
export type { CommandListenerPriority, EditorConfig, EditorThemeClasses, IntentionallyMarkedAsDirtyElement, LexicalCommand, LexicalEditor, NodeMutation, ReadOnlyListener, SerializedEditor, Spread, } from './LexicalEditor';
|
|
8
|
+
export type { CommandListenerPriority, CommandPayloadType, EditorConfig, EditorThemeClasses, IntentionallyMarkedAsDirtyElement, Klass, LexicalCommand, LexicalEditor, NodeMutation, ReadOnlyListener, SerializedEditor, Spread, } from './LexicalEditor';
|
|
9
9
|
export type { EditorState, SerializedEditorState } from './LexicalEditorState';
|
|
10
10
|
export type { DOMChildConversion, DOMConversion, DOMConversionFn, DOMConversionMap, DOMConversionOutput, DOMExportOutput, LexicalNode, NodeKey, NodeMap, SerializedLexicalNode, } from './LexicalNode';
|
|
11
11
|
export type { BaseSelection, ElementPointType as ElementPoint, GridSelection, GridSelectionShape, NodeSelection, Point, RangeSelection, TextPointType as TextPoint, } from './LexicalSelection';
|
|
@@ -66,6 +66,6 @@ export declare class ElementNode extends LexicalNode {
|
|
|
66
66
|
canInsertTextAfter(): boolean;
|
|
67
67
|
isInline(): boolean;
|
|
68
68
|
canMergeWith(node: ElementNode): boolean;
|
|
69
|
-
extractWithChild(child: LexicalNode, selection: RangeSelection | NodeSelection | GridSelection, destination: 'clone' | 'html'): boolean;
|
|
69
|
+
extractWithChild(child: LexicalNode, selection: RangeSelection | NodeSelection | GridSelection | null, destination: 'clone' | 'html'): boolean;
|
|
70
70
|
}
|
|
71
71
|
export declare function $isElementNode(node: LexicalNode | null | undefined): node is ElementNode;
|
|
@@ -18,6 +18,7 @@ export declare type SerializedTextNode = Spread<{
|
|
|
18
18
|
text: string;
|
|
19
19
|
}, SerializedLexicalNode>;
|
|
20
20
|
export declare type TextFormatType = 'bold' | 'underline' | 'strikethrough' | 'italic' | 'code' | 'subscript' | 'superscript';
|
|
21
|
+
export declare type TextDetailType = 'directionless' | 'unmergable';
|
|
21
22
|
export declare type TextModeType = 'normal' | 'token' | 'segmented' | 'inert';
|
|
22
23
|
export declare type TextMark = {
|
|
23
24
|
end: null | number;
|
|
@@ -54,8 +55,8 @@ export declare class TextNode extends LexicalNode {
|
|
|
54
55
|
static importJSON(serializedNode: SerializedTextNode): TextNode;
|
|
55
56
|
exportJSON(): SerializedTextNode;
|
|
56
57
|
selectionTransform(prevSelection: null | RangeSelection | NodeSelection | GridSelection, nextSelection: RangeSelection): void;
|
|
57
|
-
setFormat(format: number): this;
|
|
58
|
-
setDetail(detail: number): this;
|
|
58
|
+
setFormat(format: TextFormatType | number): this;
|
|
59
|
+
setDetail(detail: TextDetailType | number): this;
|
|
59
60
|
setStyle(style: string): this;
|
|
60
61
|
toggleFormat(type: TextFormatType): this;
|
|
61
62
|
toggleDirectionless(): this;
|
package/package.json
CHANGED
|
@@ -9,14 +9,11 @@
|
|
|
9
9
|
"rich-text"
|
|
10
10
|
],
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"version": "0.3.
|
|
12
|
+
"version": "0.3.8",
|
|
13
13
|
"main": "Lexical.js",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "https://github.com/facebook/lexical",
|
|
17
17
|
"directory": "packages/lexical"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"utility-types": "^3.10.0"
|
|
21
18
|
}
|
|
22
19
|
}
|