lexical 0.1.16 → 0.1.19
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/LICENSE +1 -1
- package/Lexical.d.ts +69 -21
- package/Lexical.dev.js +410 -283
- package/Lexical.js.flow +67 -23
- package/Lexical.prod.js +156 -155
- package/README.md +4 -4
- package/package.json +1 -5
- package/AutoLinkNode.d.ts +0 -20
- package/AutoLinkNode.js +0 -9
- package/AutoLinkNode.js.flow +0 -25
- package/CodeHighlightNode.d.ts +0 -39
- package/CodeHighlightNode.js +0 -9
- package/CodeHighlightNode.js.flow +0 -43
- package/CodeNode.d.ts +0 -39
- package/CodeNode.js +0 -9
- package/CodeNode.js.flow +0 -46
- package/ExtendedNodes.d.ts +0 -13
- package/HashtagNode.d.ts +0 -22
- package/HeadingNode.d.ts +0 -24
- package/HeadingNode.js +0 -9
- package/HeadingNode.js.flow +0 -32
- package/LexicalAutoLinkNode.dev.js +0 -58
- package/LexicalAutoLinkNode.prod.js +0 -7
- package/LexicalCodeHighlightNode.dev.js +0 -80
- package/LexicalCodeHighlightNode.prod.js +0 -9
- package/LexicalCodeNode.dev.js +0 -254
- package/LexicalCodeNode.prod.js +0 -12
- package/LexicalExtendedNode.js +0 -9
- package/LexicalExtendedNode.js.flow +0 -12
- package/LexicalExtendedNodes.dev.js +0 -30
- package/LexicalExtendedNodes.prod.js +0 -8
- package/LexicalHeadingNode.dev.js +0 -124
- package/LexicalHeadingNode.prod.js +0 -10
- package/LexicalLinkNode.dev.js +0 -122
- package/LexicalLinkNode.prod.js +0 -9
- package/LexicalOverflowNode.dev.js +0 -67
- package/LexicalOverflowNode.prod.js +0 -8
- package/LexicalQuoteNode.dev.js +0 -71
- package/LexicalQuoteNode.prod.js +0 -9
- package/LinkNode.d.ts +0 -31
- package/LinkNode.js +0 -9
- package/LinkNode.js.flow +0 -37
- package/OverflowNode.d.ts +0 -21
- package/OverflowNode.js +0 -9
- package/OverflowNode.js.flow +0 -26
- package/QuoteNode.d.ts +0 -21
- package/QuoteNode.js +0 -9
- package/QuoteNode.js.flow +0 -24
package/LICENSE
CHANGED
package/Lexical.d.ts
CHANGED
|
@@ -8,6 +8,55 @@
|
|
|
8
8
|
|
|
9
9
|
import {Class, $ReadOnly} from 'utility-types';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* LexicalCommands
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export type LexicalCommand<P> = $ReadOnly<{}>;
|
|
16
|
+
|
|
17
|
+
export var SELECTION_CHANGE_COMMAND: LexicalCommand<void>;
|
|
18
|
+
export var CLICK_COMMAND: LexicalCommand<MouseEvent>;
|
|
19
|
+
export var DELETE_CHARACTER_COMMAND: LexicalCommand<boolean>;
|
|
20
|
+
export var INSERT_LINE_BREAK_COMMAND: LexicalCommand<boolean>;
|
|
21
|
+
export var INSERT_PARAGRAPH_COMMAND: LexicalCommand<void>;
|
|
22
|
+
export var INSERT_TEXT_COMMAND: LexicalCommand<InputEvent | string>;
|
|
23
|
+
export var PASTE_COMMAND: LexicalCommand<ClipboardEvent>;
|
|
24
|
+
export var REMOVE_TEXT_COMMAND: LexicalCommand<void>;
|
|
25
|
+
export var DELETE_WORD_COMMAND: LexicalCommand<boolean>;
|
|
26
|
+
export var DELETE_LINE_COMMAND: LexicalCommand<boolean>;
|
|
27
|
+
export var FORMAT_TEXT_COMMAND: LexicalCommand<TextFormatType>;
|
|
28
|
+
export var UNDO_COMMAND: LexicalCommand<void>;
|
|
29
|
+
export var REDO_COMMAND: LexicalCommand<void>;
|
|
30
|
+
export var KEY_ARROW_RIGHT_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
31
|
+
export var KEY_ARROW_LEFT_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
32
|
+
export var KEY_ARROW_UP_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
33
|
+
export var KEY_ARROW_DOWN_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
34
|
+
export var KEY_ENTER_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
35
|
+
export var KEY_BACKSPACE_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
36
|
+
export var KEY_ESCAPE_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
37
|
+
export var KEY_DELETE_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
38
|
+
export var KEY_TAB_COMMAND: LexicalCommand<KeyboardEvent>;
|
|
39
|
+
export var INDENT_CONTENT_COMMAND: LexicalCommand<void>;
|
|
40
|
+
export var OUTDENT_CONTENT_COMMAND: LexicalCommand<void>;
|
|
41
|
+
export var DROP_COMMAND: LexicalCommand<DragEvent>;
|
|
42
|
+
export var FORMAT_ELEMENT_COMMAND: LexicalCommand<ElementFormatType>;
|
|
43
|
+
export var DRAGSTART_COMMAND: LexicalCommand<DragEvent>;
|
|
44
|
+
export var COPY_COMMAND: LexicalCommand<ClipboardEvent>;
|
|
45
|
+
export var CUT_COMMAND: LexicalCommand<ClipboardEvent>;
|
|
46
|
+
export var CLEAR_EDITOR_COMMAND: LexicalCommand<void>;
|
|
47
|
+
export var CLEAR_HISTORY_COMMAND: LexicalCommand<void>;
|
|
48
|
+
export var CAN_REDO_COMMAND: LexicalCommand<boolean>;
|
|
49
|
+
export var CAN_UNDO_COMMAND: LexicalCommand<boolean>;
|
|
50
|
+
export var FOCUS_COMMAND: LexicalCommand<FocusEvent>;
|
|
51
|
+
export var BLUR_COMMAND: LexicalCommand<FocusEvent>;
|
|
52
|
+
export var INSERT_TABLE_COMMAND: LexicalCommand<{
|
|
53
|
+
rows: string;
|
|
54
|
+
columns: string;
|
|
55
|
+
}>;
|
|
56
|
+
export var READ_ONLY_COMMAND: LexicalCommand<void>;
|
|
57
|
+
|
|
58
|
+
export declare function createCommand<T>(): LexicalCommand<T>;
|
|
59
|
+
|
|
11
60
|
/**
|
|
12
61
|
* LexicalEditor
|
|
13
62
|
*/
|
|
@@ -29,21 +78,18 @@ type RootListener = (
|
|
|
29
78
|
) => void;
|
|
30
79
|
type TextContentListener = (text: string) => void;
|
|
31
80
|
type MutationListener = (nodes: Map<NodeKey, NodeMutation>) => void;
|
|
32
|
-
type CommandListener = (
|
|
33
|
-
type: string,
|
|
34
|
-
payload: CommandPayload,
|
|
35
|
-
editor: LexicalEditor,
|
|
36
|
-
) => boolean;
|
|
81
|
+
type CommandListener<P> = (payload: P, editor: LexicalEditor) => boolean;
|
|
37
82
|
export type ReadOnlyListener = (readOnly: boolean) => void;
|
|
38
83
|
|
|
39
|
-
type
|
|
84
|
+
type InternalCommandListener = CommandListener<any>;
|
|
85
|
+
|
|
40
86
|
type Listeners = {
|
|
41
87
|
decorator: Set<DecoratorListener>;
|
|
42
88
|
mutation: MutationListeners;
|
|
43
89
|
textcontent: Set<TextContentListener>;
|
|
44
90
|
root: Set<RootListener>;
|
|
45
91
|
update: Set<UpdateListener>;
|
|
46
|
-
command: Array<Set<
|
|
92
|
+
command: Map<string, Array<Set<InternalCommandListener>>>;
|
|
47
93
|
};
|
|
48
94
|
type RegisteredNodes = Map<string, RegisteredNode>;
|
|
49
95
|
type RegisteredNode = {
|
|
@@ -82,26 +128,25 @@ export declare class LexicalEditor {
|
|
|
82
128
|
_key: string;
|
|
83
129
|
_readOnly: boolean;
|
|
84
130
|
isComposing(): boolean;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
listener: CommandListener
|
|
131
|
+
registerUpdateListener(listener: UpdateListener): () => void;
|
|
132
|
+
registerRootListener(listener: RootListener): () => void;
|
|
133
|
+
registerDecoratorListener(listener: DecoratorListener): () => void;
|
|
134
|
+
registerTextContentListener(listener: TextContentListener): () => void;
|
|
135
|
+
registerCommand<P>(
|
|
136
|
+
command: LexicalCommand<P>,
|
|
137
|
+
listener: CommandListener<P>,
|
|
92
138
|
priority: CommandListenerPriority,
|
|
93
139
|
): () => void;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
type: 'mutation',
|
|
140
|
+
registerReadOnlyListener(listener: ReadOnlyListener): () => void;
|
|
141
|
+
registerMutationListener(
|
|
97
142
|
klass: Class<LexicalNode>,
|
|
98
143
|
listener: MutationListener,
|
|
99
144
|
): () => void;
|
|
100
|
-
|
|
145
|
+
registerNodeTransform<T extends LexicalNode>(
|
|
101
146
|
klass: Class<T>,
|
|
102
147
|
listener: Transform<T>,
|
|
103
148
|
): () => void;
|
|
104
|
-
|
|
149
|
+
dispatchCommand(type: string, payload: P): boolean;
|
|
105
150
|
hasNodes(nodes: Array<Class<LexicalNode>>): boolean;
|
|
106
151
|
getDecorators<X>(): Record<NodeKey, X>;
|
|
107
152
|
getRootElement(): null | HTMLElement;
|
|
@@ -224,7 +269,7 @@ type JSONEditorState = {
|
|
|
224
269
|
_nodeMap: Array<[NodeKey, LexicalNode]>;
|
|
225
270
|
_selection: null | ParsedSelection;
|
|
226
271
|
};
|
|
227
|
-
export
|
|
272
|
+
export interface EditorState {
|
|
228
273
|
_nodeMap: NodeMap;
|
|
229
274
|
_selection: null | RangeSelection | NodeSelection | GridSelection;
|
|
230
275
|
_flushSync: boolean;
|
|
@@ -252,7 +297,10 @@ export type DOMConversionFn = (
|
|
|
252
297
|
element: Node,
|
|
253
298
|
parent?: Node,
|
|
254
299
|
) => DOMConversionOutput;
|
|
255
|
-
export type DOMChildConversion = (
|
|
300
|
+
export type DOMChildConversion = (
|
|
301
|
+
lexicalNode: LexicalNode,
|
|
302
|
+
parentLexicalNode: ?(LexicalNode | null),
|
|
303
|
+
) => ?(LexicalNode | void | null);
|
|
256
304
|
export type DOMConversionMap = Record<
|
|
257
305
|
NodeName,
|
|
258
306
|
(node: Node) => DOMConversion | null
|