lexical 0.7.8 → 0.8.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.
@@ -93,6 +93,7 @@ export declare type EditorThemeClasses = {
93
93
  base?: EditorThemeClassName;
94
94
  focus?: EditorThemeClassName;
95
95
  };
96
+ indent?: EditorThemeClassName;
96
97
  [key: string]: any;
97
98
  };
98
99
  export declare type EditorConfig = {
@@ -105,6 +106,7 @@ export declare type RegisteredNode = {
105
106
  klass: Klass<LexicalNode>;
106
107
  transforms: Set<Transform<LexicalNode>>;
107
108
  replace: null | ((node: LexicalNode) => LexicalNode);
109
+ replaceWithKlass: null | Klass<LexicalNode>;
108
110
  };
109
111
  export declare type Transform<T extends LexicalNode> = (node: T) => void;
110
112
  export declare type ErrorHandler = (error: Error) => void;
@@ -185,6 +187,7 @@ export declare function createEditor(editorConfig?: {
185
187
  with: <T extends {
186
188
  new (...args: any): any;
187
189
  }>(node: InstanceType<T>) => LexicalNode;
190
+ withKlass?: Klass<LexicalNode>;
188
191
  }>;
189
192
  onError?: ErrorHandler;
190
193
  parentEditor?: LexicalEditor;
@@ -230,6 +233,7 @@ export declare class LexicalEditor {
230
233
  registerRootListener(listener: RootListener): () => void;
231
234
  registerCommand<P>(command: LexicalCommand<P>, listener: CommandListener<P>, priority: CommandListenerPriority): () => void;
232
235
  registerMutationListener(klass: Klass<LexicalNode>, listener: MutationListener): () => void;
236
+ private registerNodeTransformToKlass;
233
237
  registerNodeTransform<T extends LexicalNode>(klass: Klass<T>, listener: Transform<T>): () => void;
234
238
  hasNodes<T extends Klass<LexicalNode>>(nodes: Array<T>): boolean;
235
239
  dispatchCommand<TCommand extends LexicalCommand<unknown>>(type: TCommand, payload: CommandPayloadType<TCommand>): boolean;
@@ -11,4 +11,4 @@ export declare type EventHandler = (event: Event, editor: LexicalEditor) => void
11
11
  export declare function addRootElementEvents(rootElement: HTMLElement, editor: LexicalEditor): void;
12
12
  export declare function removeRootElementEvents(rootElement: HTMLElement): void;
13
13
  export declare function markSelectionChangeFromDOMUpdate(): void;
14
- export declare function markCollapsedSelectionFormat(format: number, offset: number, key: NodeKey, timeStamp: number): void;
14
+ export declare function markCollapsedSelectionFormat(format: number, style: string, offset: number, key: NodeKey, timeStamp: number): void;
@@ -105,8 +105,9 @@ export declare class RangeSelection implements BaseSelection {
105
105
  focus: PointType;
106
106
  dirty: boolean;
107
107
  format: number;
108
+ style: string;
108
109
  _cachedNodes: null | Array<LexicalNode>;
109
- constructor(anchor: PointType, focus: PointType, format: number);
110
+ constructor(anchor: PointType, focus: PointType, format: number, style: string);
110
111
  is(selection: null | RangeSelection | NodeSelection | GridSelection): boolean;
111
112
  isBackward(): boolean;
112
113
  isCollapsed(): boolean;
@@ -116,6 +117,7 @@ export declare class RangeSelection implements BaseSelection {
116
117
  applyDOMRange(range: StaticRange): void;
117
118
  clone(): RangeSelection;
118
119
  toggleFormat(format: TextFormatType): void;
120
+ setStyle(style: string): void;
119
121
  hasFormat(type: TextFormatType): boolean;
120
122
  insertRawText(text: string): void;
121
123
  insertText(text: string): void;
package/LexicalUtils.d.ts CHANGED
@@ -109,3 +109,4 @@ export declare function $getNodeByKeyOrThrow<N extends LexicalNode>(key: NodeKey
109
109
  export declare function removeDOMBlockCursorElement(blockCursorElement: HTMLElement, editor: LexicalEditor, rootElement: HTMLElement): void;
110
110
  export declare function updateDOMBlockCursorElement(editor: LexicalEditor, rootElement: HTMLElement, nextSelection: null | RangeSelection | NodeSelection | GridSelection): void;
111
111
  export declare function getDOMSelection(targetWindow: null | Window): null | Selection;
112
+ export declare function $splitNode(node: ElementNode, offset: number): [ElementNode | null, ElementNode];
package/index.d.ts CHANGED
@@ -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, $getAdjacentNode, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getRoot, $hasAncestor, $isInlineElementOrDecoratorNode, $isLeafNode, $isRootOrShadowRoot, $nodesOfType, $setCompositionKey, $setSelection, isSelectionWithinEditor, } from './LexicalUtils';
24
+ export { $addUpdateTag, $applyNodeReplacement, $copyNode, $getAdjacentNode, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getRoot, $hasAncestor, $isInlineElementOrDecoratorNode, $isLeafNode, $isRootOrShadowRoot, $nodesOfType, $setCompositionKey, $setSelection, $splitNode, isSelectionWithinEditor, } from './LexicalUtils';
25
25
  export { $isDecoratorNode, DecoratorNode } from './nodes/LexicalDecoratorNode';
26
26
  export { $isElementNode, ElementNode } from './nodes/LexicalElementNode';
27
27
  export { DEPRECATED_$isGridCellNode, DEPRECATED_GridCellNode, } from './nodes/LexicalGridCellNode';
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "rich-text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.7.8",
12
+ "version": "0.8.0",
13
13
  "main": "Lexical.js",
14
14
  "repository": {
15
15
  "type": "git",