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.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<SerializedNode>(
168
- maybeStringifiedEditorState: string | SerializedEditorState<SerializedNode>,
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<SerializedNode>(): SerializedEditorState<SerializedNode>;
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<SerializedNode> {
878
- root: SerializedRootNode<SerializedNode>;
884
+ export interface SerializedEditorState {
885
+ root: SerializedRootNode;
879
886
  }
880
887
 
881
- export type SerializedEditor<SerializedNode> = {
882
- editorState: SerializedEditorState<SerializedNode>,
888
+ export type SerializedEditor = {
889
+ editorState: SerializedEditorState,
883
890
  };