lexical 0.3.1 → 0.3.4
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 +231 -214
- package/Lexical.js.flow +17 -10
- package/Lexical.prod.js +172 -170
- package/LexicalCommands.d.ts +50 -0
- package/LexicalConstants.d.ts +42 -0
- package/LexicalEditor.d.ts +200 -0
- package/LexicalEditorState.d.ts +28 -0
- package/LexicalEvents.d.ts +14 -0
- package/LexicalGC.d.ts +12 -0
- package/LexicalMutations.d.ts +12 -0
- package/LexicalNode.d.ts +82 -0
- package/LexicalNormalization.d.ts +9 -0
- package/LexicalReconciler.d.ts +12 -0
- package/LexicalSelection.d.ts +147 -0
- package/LexicalUpdates.d.ts +25 -0
- package/LexicalUtils.d.ts +95 -0
- package/LexicalVersion.d.ts +8 -0
- package/README.md +1 -0
- package/index.d.ts +31 -0
- package/nodes/LexicalDecoratorNode.d.ts +18 -0
- package/nodes/LexicalElementNode.d.ts +71 -0
- package/nodes/LexicalGridCellNode.d.ts +18 -0
- package/nodes/LexicalGridNode.d.ts +12 -0
- package/nodes/LexicalGridRowNode.d.ts +12 -0
- package/nodes/LexicalLineBreakNode.d.ts +26 -0
- package/nodes/LexicalParagraphNode.d.ts +30 -0
- package/nodes/LexicalRootNode.d.ts +29 -0
- package/nodes/LexicalTextNode.d.ts +74 -0
- package/package.json +4 -2
- package/Lexical.d.ts +0 -849
package/Lexical.js.flow
CHANGED
|
@@ -164,8 +164,8 @@ declare export class LexicalEditor {
|
|
|
164
164
|
getElementByKey(key: NodeKey): null | HTMLElement;
|
|
165
165
|
getEditorState(): EditorState;
|
|
166
166
|
setEditorState(editorState: EditorState, options?: EditorSetOptions): void;
|
|
167
|
-
parseEditorState
|
|
168
|
-
maybeStringifiedEditorState: string | SerializedEditorState
|
|
167
|
+
parseEditorState(
|
|
168
|
+
maybeStringifiedEditorState: string | SerializedEditorState,
|
|
169
169
|
updateFn?: () => void,
|
|
170
170
|
): EditorState;
|
|
171
171
|
update(updateFn: () => void, options?: EditorUpdateOptions): boolean;
|
|
@@ -173,7 +173,7 @@ declare export class LexicalEditor {
|
|
|
173
173
|
blur(): void;
|
|
174
174
|
isReadOnly(): boolean;
|
|
175
175
|
setReadOnly(readOnly: boolean): void;
|
|
176
|
-
toJSON(): SerializedEditor
|
|
176
|
+
toJSON(): SerializedEditor;
|
|
177
177
|
}
|
|
178
178
|
type EditorUpdateOptions = {
|
|
179
179
|
onUpdate?: () => void,
|
|
@@ -231,12 +231,18 @@ export type EditorThemeClasses = {
|
|
|
231
231
|
h3?: EditorThemeClassName,
|
|
232
232
|
h4?: EditorThemeClassName,
|
|
233
233
|
h5?: EditorThemeClassName,
|
|
234
|
+
h6?: EditorThemeClassName,
|
|
235
|
+
},
|
|
236
|
+
embedBlock?: {
|
|
237
|
+
base?: EditorThemeClassName,
|
|
238
|
+
focus?: EditorThemeClassName,
|
|
234
239
|
},
|
|
235
240
|
// Handle other generic values
|
|
236
241
|
[string]: EditorThemeClassName | {[string]: EditorThemeClassName},
|
|
237
242
|
};
|
|
238
243
|
export type EditorConfig = {
|
|
239
244
|
theme: EditorThemeClasses,
|
|
245
|
+
namespace: string,
|
|
240
246
|
disableEvents?: boolean,
|
|
241
247
|
};
|
|
242
248
|
export type CommandListenerPriority = 0 | 1 | 2 | 3 | 4;
|
|
@@ -249,6 +255,7 @@ export const COMMAND_PRIORITY_CRITICAL = 4;
|
|
|
249
255
|
export type IntentionallyMarkedAsDirtyElement = boolean;
|
|
250
256
|
declare export function createEditor(editorConfig?: {
|
|
251
257
|
editorState?: EditorState,
|
|
258
|
+
namespace: string,
|
|
252
259
|
theme?: EditorThemeClasses,
|
|
253
260
|
parentEditor?: LexicalEditor,
|
|
254
261
|
nodes?: $ReadOnlyArray<Class<LexicalNode>>,
|
|
@@ -272,7 +279,7 @@ export interface EditorState {
|
|
|
272
279
|
): void;
|
|
273
280
|
isEmpty(): boolean;
|
|
274
281
|
read<V>(callbackFn: () => V): V;
|
|
275
|
-
toJSON
|
|
282
|
+
toJSON(): SerializedEditorState;
|
|
276
283
|
clone(
|
|
277
284
|
selection?: RangeSelection | NodeSelection | GridSelection | null,
|
|
278
285
|
): EditorState;
|
|
@@ -726,7 +733,7 @@ declare export function $isElementNode(
|
|
|
726
733
|
|
|
727
734
|
declare export class DecoratorNode<X> extends LexicalNode {
|
|
728
735
|
constructor(key?: NodeKey): void;
|
|
729
|
-
decorate(editor: LexicalEditor): X;
|
|
736
|
+
decorate(editor: LexicalEditor, config: EditorConfig): X;
|
|
730
737
|
isIsolated(): boolean;
|
|
731
738
|
isTopLevel(): boolean;
|
|
732
739
|
}
|
|
@@ -803,7 +810,7 @@ declare export function $getDecoratorNode(
|
|
|
803
810
|
focus: Point,
|
|
804
811
|
isBackward: boolean,
|
|
805
812
|
): null | LexicalNode;
|
|
806
|
-
|
|
813
|
+
declare export function generateRandomKey(): string;
|
|
807
814
|
export type EventHandler = (event: Event, editor: LexicalEditor) => void;
|
|
808
815
|
|
|
809
816
|
/**
|
|
@@ -874,10 +881,10 @@ export type SerializedGridCellNode = {
|
|
|
874
881
|
...
|
|
875
882
|
};
|
|
876
883
|
|
|
877
|
-
export interface SerializedEditorState
|
|
878
|
-
root: SerializedRootNode
|
|
884
|
+
export interface SerializedEditorState {
|
|
885
|
+
root: SerializedRootNode;
|
|
879
886
|
}
|
|
880
887
|
|
|
881
|
-
export type SerializedEditor
|
|
882
|
-
editorState: SerializedEditorState
|
|
888
|
+
export type SerializedEditor = {
|
|
889
|
+
editorState: SerializedEditorState,
|
|
883
890
|
};
|