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.js.flow
CHANGED
|
@@ -30,7 +30,7 @@ declare export var KEY_ARROW_RIGHT_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
|
30
30
|
declare export var KEY_ARROW_LEFT_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
31
31
|
declare export var KEY_ARROW_UP_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
32
32
|
declare export var KEY_ARROW_DOWN_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
33
|
-
declare export var KEY_ENTER_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
33
|
+
declare export var KEY_ENTER_COMMAND: LexicalCommand<KeyboardEvent | null>;
|
|
34
34
|
declare export var KEY_BACKSPACE_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
35
35
|
declare export var KEY_ESCAPE_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
36
36
|
declare export var KEY_DELETE_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
@@ -48,7 +48,6 @@ declare export var CAN_REDO_COMMAND: LexicalCommand<boolean>;
|
|
|
48
48
|
declare export var CAN_UNDO_COMMAND: LexicalCommand<boolean>;
|
|
49
49
|
declare export var FOCUS_COMMAND: LexicalCommand<FocusEvent>;
|
|
50
50
|
declare export var BLUR_COMMAND: LexicalCommand<FocusEvent>;
|
|
51
|
-
declare export var READ_ONLY_COMMAND: LexicalCommand<void>;
|
|
52
51
|
|
|
53
52
|
declare export function createCommand<T>(): LexicalCommand<T>;
|
|
54
53
|
|
|
@@ -151,6 +150,7 @@ declare export class LexicalEditor {
|
|
|
151
150
|
): () => void;
|
|
152
151
|
dispatchCommand<P>(command: LexicalCommand<P>, payload?: P): boolean;
|
|
153
152
|
hasNodes(nodes: Array<Class<LexicalNode>>): boolean;
|
|
153
|
+
getKey(): string;
|
|
154
154
|
getDecorators<X>(): {
|
|
155
155
|
[NodeKey]: X,
|
|
156
156
|
};
|
|
@@ -227,17 +227,12 @@ export type EditorConfig<EditorContext> = {
|
|
|
227
227
|
context: EditorContext,
|
|
228
228
|
disableEvents?: boolean,
|
|
229
229
|
};
|
|
230
|
-
export type
|
|
231
|
-
export
|
|
232
|
-
export
|
|
233
|
-
export
|
|
234
|
-
export
|
|
235
|
-
|
|
236
|
-
| CommandListenerEditorPriority
|
|
237
|
-
| CommandListenerLowPriority
|
|
238
|
-
| CommandListenerNormalPriority
|
|
239
|
-
| CommandListenerHighPriority
|
|
240
|
-
| CommandListenerCriticalPriority;
|
|
230
|
+
export type CommandListenerPriority = 0 | 1 | 2 | 3 | 4;
|
|
231
|
+
export const COMMAND_PRIORITY_EDITOR = 0;
|
|
232
|
+
export const COMMAND_PRIORITY_LOW = 1;
|
|
233
|
+
export const COMMAND_PRIORITY_NORMAL = 2;
|
|
234
|
+
export const COMMAND_PRIORITY_HIGH = 3;
|
|
235
|
+
export const COMMAND_PRIORITY_CRITICAL = 4;
|
|
241
236
|
|
|
242
237
|
export type IntentionallyMarkedAsDirtyElement = boolean;
|
|
243
238
|
declare export function createEditor<EditorContext>(editorConfig?: {
|
|
@@ -587,140 +582,6 @@ declare export function $getPreviousSelection():
|
|
|
587
582
|
| NodeSelection
|
|
588
583
|
| GridSelection;
|
|
589
584
|
|
|
590
|
-
/**
|
|
591
|
-
* Decorator State
|
|
592
|
-
*/
|
|
593
|
-
|
|
594
|
-
export type DecoratorStateValue =
|
|
595
|
-
| DecoratorMap
|
|
596
|
-
| DecoratorEditor
|
|
597
|
-
| DecoratorArray
|
|
598
|
-
| null
|
|
599
|
-
| boolean
|
|
600
|
-
| number
|
|
601
|
-
| string;
|
|
602
|
-
|
|
603
|
-
declare export class DecoratorEditor {
|
|
604
|
-
id: string;
|
|
605
|
-
editorState: null | EditorState | string;
|
|
606
|
-
editor: null | LexicalEditor;
|
|
607
|
-
|
|
608
|
-
constructor(id?: string, editorState?: string | EditorState): void;
|
|
609
|
-
|
|
610
|
-
init(editor: LexicalEditor): void;
|
|
611
|
-
|
|
612
|
-
set(editor: LexicalEditor): void;
|
|
613
|
-
|
|
614
|
-
toJSON(): $ReadOnly<{
|
|
615
|
-
id: string,
|
|
616
|
-
type: 'editor',
|
|
617
|
-
editorState: null | string,
|
|
618
|
-
}>;
|
|
619
|
-
|
|
620
|
-
isEmpty(): boolean;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
export type DecoratorMapObserver = (
|
|
624
|
-
key: string,
|
|
625
|
-
value: DecoratorStateValue,
|
|
626
|
-
) => void;
|
|
627
|
-
|
|
628
|
-
export type DecoratorArrayObserver = (
|
|
629
|
-
index: number,
|
|
630
|
-
delCont: number,
|
|
631
|
-
value: void | DecoratorStateValue,
|
|
632
|
-
) => void;
|
|
633
|
-
|
|
634
|
-
declare export class DecoratorMap {
|
|
635
|
-
_editor: LexicalEditor;
|
|
636
|
-
_map: Map<string, DecoratorStateValue>;
|
|
637
|
-
|
|
638
|
-
constructor(
|
|
639
|
-
editor: LexicalEditor,
|
|
640
|
-
map?: Map<string, DecoratorStateValue>,
|
|
641
|
-
): void;
|
|
642
|
-
|
|
643
|
-
get(key: string): void | DecoratorStateValue;
|
|
644
|
-
|
|
645
|
-
has(key: string): boolean;
|
|
646
|
-
|
|
647
|
-
set(key: string, value: DecoratorStateValue): void;
|
|
648
|
-
|
|
649
|
-
observe(observer: DecoratorMapObserver): () => void;
|
|
650
|
-
|
|
651
|
-
destroy(): void;
|
|
652
|
-
|
|
653
|
-
toJSON(): $ReadOnly<{
|
|
654
|
-
type: 'map',
|
|
655
|
-
map: Array<[string, DecoratorStateValue]>,
|
|
656
|
-
}>;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
declare export function createDecoratorEditor(
|
|
660
|
-
id?: string,
|
|
661
|
-
editorState?: string | EditorState,
|
|
662
|
-
): DecoratorEditor;
|
|
663
|
-
|
|
664
|
-
declare export function isDecoratorEditor(
|
|
665
|
-
obj: ?mixed,
|
|
666
|
-
): boolean %checks(obj instanceof DecoratorEditor);
|
|
667
|
-
|
|
668
|
-
declare export function createDecoratorMap(
|
|
669
|
-
editor: LexicalEditor,
|
|
670
|
-
map?: Map<string, DecoratorStateValue>,
|
|
671
|
-
): DecoratorMap;
|
|
672
|
-
|
|
673
|
-
declare export function isDecoratorMap(
|
|
674
|
-
obj: ?mixed,
|
|
675
|
-
): boolean %checks(obj instanceof DecoratorMap);
|
|
676
|
-
|
|
677
|
-
declare export class DecoratorArray {
|
|
678
|
-
_editor: LexicalEditor;
|
|
679
|
-
_observers: Set<DecoratorArrayObserver>;
|
|
680
|
-
_array: Array<DecoratorStateValue>;
|
|
681
|
-
|
|
682
|
-
constructor(editor: LexicalEditor, array?: Array<DecoratorStateValue>): void;
|
|
683
|
-
|
|
684
|
-
observe(observer: DecoratorArrayObserver): () => void;
|
|
685
|
-
|
|
686
|
-
map<V>(
|
|
687
|
-
fn: (DecoratorStateValue, number, Array<DecoratorStateValue>) => V,
|
|
688
|
-
): Array<V>;
|
|
689
|
-
|
|
690
|
-
reduce(
|
|
691
|
-
fn: (DecoratorStateValue, DecoratorStateValue) => DecoratorStateValue,
|
|
692
|
-
initial?: DecoratorStateValue,
|
|
693
|
-
): DecoratorStateValue | void;
|
|
694
|
-
|
|
695
|
-
push(value: DecoratorStateValue): void;
|
|
696
|
-
|
|
697
|
-
getLength(): number;
|
|
698
|
-
|
|
699
|
-
splice(
|
|
700
|
-
insertIndex: number,
|
|
701
|
-
delCount: number,
|
|
702
|
-
value?: DecoratorStateValue,
|
|
703
|
-
): void;
|
|
704
|
-
|
|
705
|
-
indexOf(value: DecoratorStateValue): number;
|
|
706
|
-
|
|
707
|
-
destroy(): void;
|
|
708
|
-
|
|
709
|
-
toJSON(): $ReadOnly<{
|
|
710
|
-
type: 'array',
|
|
711
|
-
array: Array<DecoratorStateValue>,
|
|
712
|
-
}>;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
declare export function createDecoratorArray(
|
|
716
|
-
editor: LexicalEditor,
|
|
717
|
-
list?: Array<DecoratorStateValue>,
|
|
718
|
-
): DecoratorArray;
|
|
719
|
-
|
|
720
|
-
declare export function isDecoratorArray(
|
|
721
|
-
x?: mixed,
|
|
722
|
-
): boolean %checks(x instanceof DecoratorArray);
|
|
723
|
-
|
|
724
585
|
/**
|
|
725
586
|
* LexicalTextNode
|
|
726
587
|
*/
|
|
@@ -897,8 +758,7 @@ declare export function $isElementNode(
|
|
|
897
758
|
*/
|
|
898
759
|
|
|
899
760
|
declare export class DecoratorNode<X> extends LexicalNode {
|
|
900
|
-
|
|
901
|
-
constructor(state?: DecoratorMap, key?: NodeKey): void;
|
|
761
|
+
constructor(key?: NodeKey): void;
|
|
902
762
|
decorate(editor: LexicalEditor): X;
|
|
903
763
|
isIsolated(): boolean;
|
|
904
764
|
}
|