lexical 0.1.21 → 0.2.2
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.d.ts +16 -121
- package/Lexical.dev.js +4452 -4518
- package/Lexical.js.flow +9 -149
- package/Lexical.prod.js +160 -160
- package/README.md +3 -3
- package/package.json +2 -2
package/Lexical.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export var KEY_ARROW_RIGHT_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
|
31
31
|
export var KEY_ARROW_LEFT_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
32
32
|
export var KEY_ARROW_UP_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
33
33
|
export var KEY_ARROW_DOWN_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
34
|
-
export var KEY_ENTER_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
34
|
+
export var KEY_ENTER_COMMAND: LexicalCommand<KeyboardEvent | null>;
|
|
35
35
|
export var KEY_BACKSPACE_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
36
36
|
export var KEY_ESCAPE_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
37
37
|
export var KEY_DELETE_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
@@ -53,7 +53,6 @@ export var INSERT_TABLE_COMMAND: LexicalCommand<{
|
|
|
53
53
|
rows: string;
|
|
54
54
|
columns: string;
|
|
55
55
|
}>;
|
|
56
|
-
export var READ_ONLY_COMMAND: LexicalCommand<void>;
|
|
57
56
|
|
|
58
57
|
export declare function createCommand<T>(): LexicalCommand<T>;
|
|
59
58
|
|
|
@@ -222,17 +221,12 @@ export type EditorConfig<EditorContext> = {
|
|
|
222
221
|
context: EditorContext;
|
|
223
222
|
disableEvents?: boolean;
|
|
224
223
|
};
|
|
225
|
-
export type
|
|
226
|
-
export
|
|
227
|
-
export
|
|
228
|
-
export
|
|
229
|
-
export
|
|
230
|
-
|
|
231
|
-
| CommandListenerEditorPriority
|
|
232
|
-
| CommandListenerLowPriority
|
|
233
|
-
| CommandListenerNormalPriority
|
|
234
|
-
| CommandListenerHighPriority
|
|
235
|
-
| CommandListenerCriticalPriority;
|
|
224
|
+
export type CommandListenerPriority = 0 | 1 | 2 | 3 | 4;
|
|
225
|
+
export const COMMAND_PRIORITY_EDITOR = 0;
|
|
226
|
+
export const COMMAND_PRIORITY_LOW = 1;
|
|
227
|
+
export const COMMAND_PRIORITY_NORMAL = 2;
|
|
228
|
+
export const COMMAND_PRIORITY_HIGH = 3;
|
|
229
|
+
export const COMMAND_PRIORITY_CRITICAL = 4;
|
|
236
230
|
export type IntentionallyMarkedAsDirtyElement = boolean;
|
|
237
231
|
export function createEditor<EditorContext>(editorConfig?: {
|
|
238
232
|
namespace?: string;
|
|
@@ -551,104 +545,6 @@ export function $getPreviousSelection():
|
|
|
551
545
|
| NodeSelection
|
|
552
546
|
| GridSelection;
|
|
553
547
|
|
|
554
|
-
/**
|
|
555
|
-
* Decorator State
|
|
556
|
-
*/
|
|
557
|
-
export type DecoratorStateValue =
|
|
558
|
-
| DecoratorMap
|
|
559
|
-
| DecoratorEditor
|
|
560
|
-
| DecoratorArray
|
|
561
|
-
| null
|
|
562
|
-
| boolean
|
|
563
|
-
| number
|
|
564
|
-
| string;
|
|
565
|
-
export declare class DecoratorEditor {
|
|
566
|
-
id: string;
|
|
567
|
-
editorState: null | EditorState | string;
|
|
568
|
-
editor: null | LexicalEditor;
|
|
569
|
-
constructor(id?: string, editorState?: string | EditorState);
|
|
570
|
-
init(editor: LexicalEditor): void;
|
|
571
|
-
set(editor: LexicalEditor): void;
|
|
572
|
-
toJSON(): $ReadOnly<{
|
|
573
|
-
id: string;
|
|
574
|
-
type: 'editor';
|
|
575
|
-
editorState: null | string;
|
|
576
|
-
}>;
|
|
577
|
-
isEmpty(): boolean;
|
|
578
|
-
}
|
|
579
|
-
export type DecoratorMapObserver = (
|
|
580
|
-
key: string,
|
|
581
|
-
value: DecoratorStateValue,
|
|
582
|
-
) => void;
|
|
583
|
-
export type DecoratorArrayObserver = (
|
|
584
|
-
index: number,
|
|
585
|
-
delCont: number,
|
|
586
|
-
value: void | DecoratorStateValue,
|
|
587
|
-
) => void;
|
|
588
|
-
export declare class DecoratorMap {
|
|
589
|
-
_editor: LexicalEditor;
|
|
590
|
-
_map: Map<string, DecoratorStateValue>;
|
|
591
|
-
constructor(editor: LexicalEditor, map?: Map<string, DecoratorStateValue>);
|
|
592
|
-
get(key: string): void | DecoratorStateValue;
|
|
593
|
-
has(key: string): boolean;
|
|
594
|
-
set(key: string, value: DecoratorStateValue): void;
|
|
595
|
-
observe(observer: DecoratorMapObserver): () => void;
|
|
596
|
-
destroy(): void;
|
|
597
|
-
toJSON(): {
|
|
598
|
-
type: 'map';
|
|
599
|
-
map: Array<[string, DecoratorStateValue]>;
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
export function createDecoratorEditor(
|
|
603
|
-
id?: string,
|
|
604
|
-
editorState?: string | EditorState,
|
|
605
|
-
): DecoratorEditor;
|
|
606
|
-
export function isDecoratorEditor(obj: unknown | null | undefined): boolean;
|
|
607
|
-
export function createDecoratorMap(
|
|
608
|
-
editor: LexicalEditor,
|
|
609
|
-
map?: Map<string, DecoratorStateValue>,
|
|
610
|
-
): DecoratorMap;
|
|
611
|
-
export function isDecoratorMap(obj: unknown | null | undefined): boolean;
|
|
612
|
-
export declare class DecoratorArray {
|
|
613
|
-
_editor: LexicalEditor;
|
|
614
|
-
_observers: Set<DecoratorArrayObserver>;
|
|
615
|
-
_array: Array<DecoratorStateValue>;
|
|
616
|
-
constructor(editor: LexicalEditor, array?: Array<DecoratorStateValue>);
|
|
617
|
-
observe(observer: DecoratorArrayObserver): () => void;
|
|
618
|
-
map<V>(
|
|
619
|
-
fn: (
|
|
620
|
-
arg0: DecoratorStateValue,
|
|
621
|
-
arg1: number,
|
|
622
|
-
arg2: Array<DecoratorStateValue>,
|
|
623
|
-
) => V,
|
|
624
|
-
): Array<V>;
|
|
625
|
-
reduce(
|
|
626
|
-
fn: (
|
|
627
|
-
arg0: DecoratorStateValue,
|
|
628
|
-
arg1: DecoratorStateValue,
|
|
629
|
-
) => DecoratorStateValue,
|
|
630
|
-
initial?: DecoratorStateValue,
|
|
631
|
-
): DecoratorStateValue | void;
|
|
632
|
-
push(value: DecoratorStateValue): void;
|
|
633
|
-
getLength(): number;
|
|
634
|
-
splice(
|
|
635
|
-
insertIndex: number,
|
|
636
|
-
delCount: number,
|
|
637
|
-
value?: DecoratorStateValue,
|
|
638
|
-
): void;
|
|
639
|
-
indexOf(value: DecoratorStateValue): number;
|
|
640
|
-
destroy(): void;
|
|
641
|
-
toJSON(): {
|
|
642
|
-
type: 'array';
|
|
643
|
-
array: Array<DecoratorStateValue>;
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
export function createDecoratorArray(
|
|
647
|
-
editor: LexicalEditor,
|
|
648
|
-
list?: Array<DecoratorStateValue>,
|
|
649
|
-
): DecoratorArray;
|
|
650
|
-
export function isDecoratorArray(x?: unknown): boolean;
|
|
651
|
-
|
|
652
548
|
/**
|
|
653
549
|
* LexicalTextNode
|
|
654
550
|
*/
|
|
@@ -667,8 +563,8 @@ export declare class TextNode extends LexicalNode {
|
|
|
667
563
|
__style: string;
|
|
668
564
|
__mode: 0 | 1 | 2 | 3;
|
|
669
565
|
__detail: number;
|
|
670
|
-
getType(): string;
|
|
671
|
-
clone(node: any): TextNode;
|
|
566
|
+
static getType(): string;
|
|
567
|
+
static clone(node: any): TextNode;
|
|
672
568
|
constructor(text: string, key?: NodeKey);
|
|
673
569
|
getFormat(): number;
|
|
674
570
|
getStyle(): string;
|
|
@@ -721,8 +617,8 @@ export function $isTextNode(node: LexicalNode | null | undefined): boolean;
|
|
|
721
617
|
* LexicalLineBreakNode
|
|
722
618
|
*/
|
|
723
619
|
export declare class LineBreakNode extends LexicalNode {
|
|
724
|
-
getType(): string;
|
|
725
|
-
clone(node: LineBreakNode): LineBreakNode;
|
|
620
|
+
static getType(): string;
|
|
621
|
+
static clone(node: LineBreakNode): LineBreakNode;
|
|
726
622
|
constructor(key?: NodeKey);
|
|
727
623
|
getTextContent(): '\n';
|
|
728
624
|
createDOM(): HTMLElement;
|
|
@@ -736,8 +632,8 @@ export function $isLineBreakNode(node: LexicalNode | null | undefined): boolean;
|
|
|
736
632
|
*/
|
|
737
633
|
export declare class RootNode extends ElementNode {
|
|
738
634
|
__cachedText: null | string;
|
|
739
|
-
getType(): string;
|
|
740
|
-
clone(): RootNode;
|
|
635
|
+
static getType(): string;
|
|
636
|
+
static clone(): RootNode;
|
|
741
637
|
constructor();
|
|
742
638
|
getTextContent(includeInert?: boolean, includeDirectionless?: false): string;
|
|
743
639
|
select(): RangeSelection;
|
|
@@ -811,8 +707,7 @@ export function $isElementNode(node: LexicalNode | null | undefined): boolean;
|
|
|
811
707
|
* LexicalDecoratorNode
|
|
812
708
|
*/
|
|
813
709
|
export declare class DecoratorNode<X> extends LexicalNode {
|
|
814
|
-
|
|
815
|
-
constructor(state?: DecoratorMap, key?: NodeKey);
|
|
710
|
+
constructor(key?: NodeKey);
|
|
816
711
|
decorate(editor: LexicalEditor): X;
|
|
817
712
|
isIsolated(): boolean;
|
|
818
713
|
}
|
|
@@ -822,8 +717,8 @@ export function $isDecoratorNode(node: LexicalNode | null | undefined): boolean;
|
|
|
822
717
|
* LexicalHorizontalRuleNode
|
|
823
718
|
*/
|
|
824
719
|
export declare class HorizontalRuleNode extends LexicalNode {
|
|
825
|
-
getType(): string;
|
|
826
|
-
clone(node: HorizontalRuleNode): HorizontalRuleNode;
|
|
720
|
+
static getType(): string;
|
|
721
|
+
static clone(node: HorizontalRuleNode): HorizontalRuleNode;
|
|
827
722
|
constructor(key?: NodeKey);
|
|
828
723
|
createDOM(): HTMLElement;
|
|
829
724
|
updateDOM(): false;
|