@examind/block-types 0.1.18
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/README.md +40 -0
- package/package.json +21 -0
- package/types/examind/index.d.ts +12 -0
- package/types/examind/nodes/EssayQuestionNode.ts +16 -0
- package/types/examind/nodes/FillInTheBlankQuestionNode.ts +14 -0
- package/types/examind/nodes/FillInTheBlankSpaceNode.ts +21 -0
- package/types/examind/nodes/FinancialStatementQuestionNode.ts +46 -0
- package/types/examind/nodes/HorizontalRuleNode.ts +3 -0
- package/types/examind/nodes/ImageNode.ts +18 -0
- package/types/examind/nodes/JournalEntryQuestionNode.ts +32 -0
- package/types/examind/nodes/MatchingQuestionNode.ts +21 -0
- package/types/examind/nodes/MultipleOptionQuestionNode.ts +29 -0
- package/types/examind/nodes/ShortAnswerQuestionNode.ts +15 -0
- package/types/examind/nodes/SimulationQuestionNode.ts +15 -0
- package/types/examind/nodes/VariableNode.ts +24 -0
- package/types/index.ts +2 -0
- package/types/lexical/LexicalCommands.ts +159 -0
- package/types/lexical/LexicalConstants.ts +51 -0
- package/types/lexical/LexicalEditor.ts +597 -0
- package/types/lexical/LexicalEditorState.ts +30 -0
- package/types/lexical/LexicalEvents.ts +13 -0
- package/types/lexical/LexicalGC.ts +13 -0
- package/types/lexical/LexicalMutations.ts +10 -0
- package/types/lexical/LexicalNode.ts +460 -0
- package/types/lexical/LexicalNodeState.ts +379 -0
- package/types/lexical/LexicalNormalization.ts +9 -0
- package/types/lexical/LexicalReconciler.ts +13 -0
- package/types/lexical/LexicalSelection.ts +295 -0
- package/types/lexical/LexicalUpdateTags.ts +51 -0
- package/types/lexical/LexicalUpdates.ts +31 -0
- package/types/lexical/LexicalUtils.ts +304 -0
- package/types/lexical/index.ts +35 -0
- package/types/lexical/link/index.ts +125 -0
- package/types/lexical/list/LexicalListItemNode.ts +65 -0
- package/types/lexical/list/LexicalListNode.ts +56 -0
- package/types/lexical/list/checkList.ts +9 -0
- package/types/lexical/list/formatList.ts +69 -0
- package/types/lexical/list/index.ts +11 -0
- package/types/lexical/list/utils.ts +64 -0
- package/types/lexical/nodes/ArtificialNode.ts +12 -0
- package/types/lexical/nodes/LexicalDecoratorNode.ts +26 -0
- package/types/lexical/nodes/LexicalElementNode.ts +207 -0
- package/types/lexical/nodes/LexicalLineBreakNode.ts +25 -0
- package/types/lexical/nodes/LexicalParagraphNode.ts +31 -0
- package/types/lexical/nodes/LexicalRootNode.ts +30 -0
- package/types/lexical/nodes/LexicalTabNode.ts +28 -0
- package/types/lexical/nodes/LexicalTextNode.ts +288 -0
- package/types/lexical/rich-text/index.ts +53 -0
- package/types/lexical/table/LexicalTableCellNode.ts +72 -0
- package/types/lexical/table/LexicalTableCommands.ts +17 -0
- package/types/lexical/table/LexicalTableNode.ts +65 -0
- package/types/lexical/table/LexicalTableObserver.ts +108 -0
- package/types/lexical/table/LexicalTablePluginHelpers.ts +25 -0
- package/types/lexical/table/LexicalTableRowNode.ts +34 -0
- package/types/lexical/table/LexicalTableSelection.ts +74 -0
- package/types/lexical/table/LexicalTableSelectionHelpers.ts +40 -0
- package/types/lexical/table/LexicalTableUtils.ts +112 -0
- package/types/lexical/table/constants.ts +8 -0
- package/types/lexical/table/index.ts +16 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
// THIS FILE IS AUTO-GENERATED
|
|
2
|
+
// To regenerate, run: pnpm build (from the root of the project)
|
|
3
|
+
|
|
4
|
+
// Type definitions based on Lexical
|
|
5
|
+
// Original copyright: Meta Platforms, Inc. and affiliates.
|
|
6
|
+
|
|
7
|
+
import type { EditorConfig, KlassConstructor, LexicalEditor, Spread } from '../LexicalEditor';
|
|
8
|
+
import type { DOMConversionMap, DOMExportOutput, LexicalUpdateJSON, NodeKey, SerializedLexicalNode } from '../LexicalNode';
|
|
9
|
+
import type { BaseSelection, RangeSelection } from '../LexicalSelection';
|
|
10
|
+
import type { ElementNode } from './LexicalElementNode';
|
|
11
|
+
import { LexicalNode } from '../LexicalNode';
|
|
12
|
+
export type SerializedTextNode = Spread<{
|
|
13
|
+
detail: number;
|
|
14
|
+
format: number;
|
|
15
|
+
mode: TextModeType;
|
|
16
|
+
style: string;
|
|
17
|
+
text: string;
|
|
18
|
+
}, SerializedLexicalNode>;
|
|
19
|
+
export type TextDetailType = 'directionless' | 'unmergable';
|
|
20
|
+
export type TextFormatType = 'bold' | 'underline' | 'strikethrough' | 'italic' | 'highlight' | 'code' | 'subscript' | 'superscript' | 'lowercase' | 'uppercase' | 'capitalize';
|
|
21
|
+
export type TextModeType = 'normal' | 'token' | 'segmented';
|
|
22
|
+
export type TextMark = {
|
|
23
|
+
end: null | number;
|
|
24
|
+
id: string;
|
|
25
|
+
start: null | number;
|
|
26
|
+
};
|
|
27
|
+
export type TextMarks = Array<TextMark>;
|
|
28
|
+
export interface TextNode {
|
|
29
|
+
getTopLevelElement(): ElementNode | null;
|
|
30
|
+
getTopLevelElementOrThrow(): ElementNode;
|
|
31
|
+
}
|
|
32
|
+
/** @noInheritDoc */
|
|
33
|
+
export declare class TextNode extends LexicalNode {
|
|
34
|
+
['constructor']: KlassConstructor<typeof TextNode>;
|
|
35
|
+
__text: string;
|
|
36
|
+
/** @internal */
|
|
37
|
+
__format: number;
|
|
38
|
+
/** @internal */
|
|
39
|
+
__style: string;
|
|
40
|
+
/** @internal */
|
|
41
|
+
__mode: 0 | 1 | 2 | 3;
|
|
42
|
+
/** @internal */
|
|
43
|
+
__detail: number;
|
|
44
|
+
static getType(): string;
|
|
45
|
+
static clone(node: TextNode): TextNode;
|
|
46
|
+
afterCloneFrom(prevNode: this): void;
|
|
47
|
+
constructor(text?: string, key?: NodeKey);
|
|
48
|
+
/**
|
|
49
|
+
* Returns a 32-bit integer that represents the TextFormatTypes currently applied to the
|
|
50
|
+
* TextNode. You probably don't want to use this method directly - consider using TextNode.hasFormat instead.
|
|
51
|
+
*
|
|
52
|
+
* @returns a number representing the format of the text node.
|
|
53
|
+
*/
|
|
54
|
+
getFormat(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Returns a 32-bit integer that represents the TextDetailTypes currently applied to the
|
|
57
|
+
* TextNode. You probably don't want to use this method directly - consider using TextNode.isDirectionless
|
|
58
|
+
* or TextNode.isUnmergeable instead.
|
|
59
|
+
*
|
|
60
|
+
* @returns a number representing the detail of the text node.
|
|
61
|
+
*/
|
|
62
|
+
getDetail(): number;
|
|
63
|
+
/**
|
|
64
|
+
* Returns the mode (TextModeType) of the TextNode, which may be "normal", "token", or "segmented"
|
|
65
|
+
*
|
|
66
|
+
* @returns TextModeType.
|
|
67
|
+
*/
|
|
68
|
+
getMode(): TextModeType;
|
|
69
|
+
/**
|
|
70
|
+
* Returns the styles currently applied to the node. This is analogous to CSSText in the DOM.
|
|
71
|
+
*
|
|
72
|
+
* @returns CSSText-like string of styles applied to the underlying DOM node.
|
|
73
|
+
*/
|
|
74
|
+
getStyle(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Returns whether or not the node is in "token" mode. TextNodes in token mode can be navigated through character-by-character
|
|
77
|
+
* with a RangeSelection, but are deleted as a single entity (not individually by character).
|
|
78
|
+
*
|
|
79
|
+
* @returns true if the node is in token mode, false otherwise.
|
|
80
|
+
*/
|
|
81
|
+
isToken(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @returns true if Lexical detects that an IME or other 3rd-party script is attempting to
|
|
85
|
+
* mutate the TextNode, false otherwise.
|
|
86
|
+
*/
|
|
87
|
+
isComposing(): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Returns whether or not the node is in "segmented" mode. TextNodes in segmented mode can be navigated through character-by-character
|
|
90
|
+
* with a RangeSelection, but are deleted in space-delimited "segments".
|
|
91
|
+
*
|
|
92
|
+
* @returns true if the node is in segmented mode, false otherwise.
|
|
93
|
+
*/
|
|
94
|
+
isSegmented(): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Returns whether or not the node is "directionless". Directionless nodes don't respect changes between RTL and LTR modes.
|
|
97
|
+
*
|
|
98
|
+
* @returns true if the node is directionless, false otherwise.
|
|
99
|
+
*/
|
|
100
|
+
isDirectionless(): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Returns whether or not the node is unmergeable. In some scenarios, Lexical tries to merge
|
|
103
|
+
* adjacent TextNodes into a single TextNode. If a TextNode is unmergeable, this won't happen.
|
|
104
|
+
*
|
|
105
|
+
* @returns true if the node is unmergeable, false otherwise.
|
|
106
|
+
*/
|
|
107
|
+
isUnmergeable(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Returns whether or not the node has the provided format applied. Use this with the human-readable TextFormatType
|
|
110
|
+
* string values to get the format of a TextNode.
|
|
111
|
+
*
|
|
112
|
+
* @param type - the TextFormatType to check for.
|
|
113
|
+
*
|
|
114
|
+
* @returns true if the node has the provided format, false otherwise.
|
|
115
|
+
*/
|
|
116
|
+
hasFormat(type: TextFormatType): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Returns whether or not the node is simple text. Simple text is defined as a TextNode that has the string type "text"
|
|
119
|
+
* (i.e., not a subclass) and has no mode applied to it (i.e., not segmented or token).
|
|
120
|
+
*
|
|
121
|
+
* @returns true if the node is simple text, false otherwise.
|
|
122
|
+
*/
|
|
123
|
+
isSimpleText(): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Returns the text content of the node as a string.
|
|
126
|
+
*
|
|
127
|
+
* @returns a string representing the text content of the node.
|
|
128
|
+
*/
|
|
129
|
+
getTextContent(): string;
|
|
130
|
+
/**
|
|
131
|
+
* Returns the format flags applied to the node as a 32-bit integer.
|
|
132
|
+
*
|
|
133
|
+
* @returns a number representing the TextFormatTypes applied to the node.
|
|
134
|
+
*/
|
|
135
|
+
getFormatFlags(type: TextFormatType, alignWithFormat: null | number): number;
|
|
136
|
+
/**
|
|
137
|
+
*
|
|
138
|
+
* @returns true if the text node supports font styling, false otherwise.
|
|
139
|
+
*/
|
|
140
|
+
canHaveFormat(): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* @returns true if the text node is inline, false otherwise.
|
|
143
|
+
*/
|
|
144
|
+
isInline(): true;
|
|
145
|
+
createDOM(config: EditorConfig, editor?: LexicalEditor): HTMLElement;
|
|
146
|
+
updateDOM(prevNode: this, dom: HTMLElement, config: EditorConfig): boolean;
|
|
147
|
+
static importDOM(): DOMConversionMap | null;
|
|
148
|
+
static importJSON(serializedNode: SerializedTextNode): TextNode;
|
|
149
|
+
updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedTextNode>): this;
|
|
150
|
+
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
|
151
|
+
exportJSON(): SerializedTextNode;
|
|
152
|
+
selectionTransform(prevSelection: null | BaseSelection, nextSelection: RangeSelection): void;
|
|
153
|
+
/**
|
|
154
|
+
* Sets the node format to the provided TextFormatType or 32-bit integer. Note that the TextFormatType
|
|
155
|
+
* version of the argument can only specify one format and doing so will remove all other formats that
|
|
156
|
+
* may be applied to the node. For toggling behavior, consider using {@link TextNode.toggleFormat}
|
|
157
|
+
*
|
|
158
|
+
* @param format - TextFormatType or 32-bit integer representing the node format.
|
|
159
|
+
*
|
|
160
|
+
* @returns this TextNode.
|
|
161
|
+
* // TODO 0.12 This should just be a `string`.
|
|
162
|
+
*/
|
|
163
|
+
setFormat(format: TextFormatType | number): this;
|
|
164
|
+
/**
|
|
165
|
+
* Sets the node detail to the provided TextDetailType or 32-bit integer. Note that the TextDetailType
|
|
166
|
+
* version of the argument can only specify one detail value and doing so will remove all other detail values that
|
|
167
|
+
* may be applied to the node. For toggling behavior, consider using {@link TextNode.toggleDirectionless}
|
|
168
|
+
* or {@link TextNode.toggleUnmergeable}
|
|
169
|
+
*
|
|
170
|
+
* @param detail - TextDetailType or 32-bit integer representing the node detail.
|
|
171
|
+
*
|
|
172
|
+
* @returns this TextNode.
|
|
173
|
+
* // TODO 0.12 This should just be a `string`.
|
|
174
|
+
*/
|
|
175
|
+
setDetail(detail: TextDetailType | number): this;
|
|
176
|
+
/**
|
|
177
|
+
* Sets the node style to the provided CSSText-like string. Set this property as you
|
|
178
|
+
* would an HTMLElement style attribute to apply inline styles to the underlying DOM Element.
|
|
179
|
+
*
|
|
180
|
+
* @param style - CSSText to be applied to the underlying HTMLElement.
|
|
181
|
+
*
|
|
182
|
+
* @returns this TextNode.
|
|
183
|
+
*/
|
|
184
|
+
setStyle(style: string): this;
|
|
185
|
+
/**
|
|
186
|
+
* Applies the provided format to this TextNode if it's not present. Removes it if it's present.
|
|
187
|
+
* The subscript and superscript formats are mutually exclusive.
|
|
188
|
+
* Prefer using this method to turn specific formats on and off.
|
|
189
|
+
*
|
|
190
|
+
* @param type - TextFormatType to toggle.
|
|
191
|
+
*
|
|
192
|
+
* @returns this TextNode.
|
|
193
|
+
*/
|
|
194
|
+
toggleFormat(type: TextFormatType): this;
|
|
195
|
+
/**
|
|
196
|
+
* Toggles the directionless detail value of the node. Prefer using this method over setDetail.
|
|
197
|
+
*
|
|
198
|
+
* @returns this TextNode.
|
|
199
|
+
*/
|
|
200
|
+
toggleDirectionless(): this;
|
|
201
|
+
/**
|
|
202
|
+
* Toggles the unmergeable detail value of the node. Prefer using this method over setDetail.
|
|
203
|
+
*
|
|
204
|
+
* @returns this TextNode.
|
|
205
|
+
*/
|
|
206
|
+
toggleUnmergeable(): this;
|
|
207
|
+
/**
|
|
208
|
+
* Sets the mode of the node.
|
|
209
|
+
*
|
|
210
|
+
* @returns this TextNode.
|
|
211
|
+
*/
|
|
212
|
+
setMode(type: TextModeType): this;
|
|
213
|
+
/**
|
|
214
|
+
* Sets the text content of the node.
|
|
215
|
+
*
|
|
216
|
+
* @param text - the string to set as the text value of the node.
|
|
217
|
+
*
|
|
218
|
+
* @returns this TextNode.
|
|
219
|
+
*/
|
|
220
|
+
setTextContent(text: string): this;
|
|
221
|
+
/**
|
|
222
|
+
* Sets the current Lexical selection to be a RangeSelection with anchor and focus on this TextNode at the provided offsets.
|
|
223
|
+
*
|
|
224
|
+
* @param _anchorOffset - the offset at which the Selection anchor will be placed.
|
|
225
|
+
* @param _focusOffset - the offset at which the Selection focus will be placed.
|
|
226
|
+
*
|
|
227
|
+
* @returns the new RangeSelection.
|
|
228
|
+
*/
|
|
229
|
+
select(_anchorOffset?: number, _focusOffset?: number): RangeSelection;
|
|
230
|
+
selectStart(): RangeSelection;
|
|
231
|
+
selectEnd(): RangeSelection;
|
|
232
|
+
/**
|
|
233
|
+
* Inserts the provided text into this TextNode at the provided offset, deleting the number of characters
|
|
234
|
+
* specified. Can optionally calculate a new selection after the operation is complete.
|
|
235
|
+
*
|
|
236
|
+
* @param offset - the offset at which the splice operation should begin.
|
|
237
|
+
* @param delCount - the number of characters to delete, starting from the offset.
|
|
238
|
+
* @param newText - the text to insert into the TextNode at the offset.
|
|
239
|
+
* @param moveSelection - optional, whether or not to move selection to the end of the inserted substring.
|
|
240
|
+
*
|
|
241
|
+
* @returns this TextNode.
|
|
242
|
+
*/
|
|
243
|
+
spliceText(offset: number, delCount: number, newText: string, moveSelection?: boolean): TextNode;
|
|
244
|
+
/**
|
|
245
|
+
* This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
|
|
246
|
+
* when a user event would cause text to be inserted before them in the editor. If true, Lexical will attempt
|
|
247
|
+
* to insert text into this node. If false, it will insert the text in a new sibling node.
|
|
248
|
+
*
|
|
249
|
+
* @returns true if text can be inserted before the node, false otherwise.
|
|
250
|
+
*/
|
|
251
|
+
canInsertTextBefore(): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
|
|
254
|
+
* when a user event would cause text to be inserted after them in the editor. If true, Lexical will attempt
|
|
255
|
+
* to insert text into this node. If false, it will insert the text in a new sibling node.
|
|
256
|
+
*
|
|
257
|
+
* @returns true if text can be inserted after the node, false otherwise.
|
|
258
|
+
*/
|
|
259
|
+
canInsertTextAfter(): boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Splits this TextNode at the provided character offsets, forming new TextNodes from the substrings
|
|
262
|
+
* formed by the split, and inserting those new TextNodes into the editor, replacing the one that was split.
|
|
263
|
+
*
|
|
264
|
+
* @param splitOffsets - rest param of the text content character offsets at which this node should be split.
|
|
265
|
+
*
|
|
266
|
+
* @returns an Array containing the newly-created TextNodes.
|
|
267
|
+
*/
|
|
268
|
+
splitText(...splitOffsets: Array<number>): Array<TextNode>;
|
|
269
|
+
/**
|
|
270
|
+
* Merges the target TextNode into this TextNode, removing the target node.
|
|
271
|
+
*
|
|
272
|
+
* @param target - the TextNode to merge into this one.
|
|
273
|
+
*
|
|
274
|
+
* @returns this TextNode.
|
|
275
|
+
*/
|
|
276
|
+
mergeWithSibling(target: TextNode): TextNode;
|
|
277
|
+
/**
|
|
278
|
+
* This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
|
|
279
|
+
* when used with the registerLexicalTextEntity function. If you're using registerLexicalTextEntity, the
|
|
280
|
+
* node class that you create and replace matched text with should return true from this method.
|
|
281
|
+
*
|
|
282
|
+
* @returns true if the node is to be treated as a "text entity", false otherwise.
|
|
283
|
+
*/
|
|
284
|
+
isTextEntity(): boolean;
|
|
285
|
+
}
|
|
286
|
+
export declare function findParentPreDOMNode(node: Node): Node | null;
|
|
287
|
+
export declare function $createTextNode(text?: string): TextNode;
|
|
288
|
+
export declare function $isTextNode(node: LexicalNode | null | undefined): node is TextNode;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// THIS FILE IS AUTO-GENERATED
|
|
2
|
+
// To regenerate, run: pnpm build (from the root of the project)
|
|
3
|
+
|
|
4
|
+
// Type definitions based on Lexical
|
|
5
|
+
// Original copyright: Meta Platforms, Inc. and affiliates.
|
|
6
|
+
|
|
7
|
+
import type { DOMConversionMap, DOMExportOutput, EditorConfig, LexicalCommand, LexicalEditor, LexicalNode, LexicalUpdateJSON, NodeKey, ParagraphNode, PasteCommandType, RangeSelection, SerializedElementNode, Spread } from './../';
|
|
8
|
+
import { ElementNode } from './../';
|
|
9
|
+
export type SerializedHeadingNode = Spread<{
|
|
10
|
+
tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
11
|
+
}, SerializedElementNode>;
|
|
12
|
+
export declare const DRAG_DROP_PASTE: LexicalCommand<Array<File>>;
|
|
13
|
+
export type SerializedQuoteNode = SerializedElementNode;
|
|
14
|
+
/** @noInheritDoc */
|
|
15
|
+
export declare class QuoteNode extends ElementNode {
|
|
16
|
+
static getType(): string;
|
|
17
|
+
static clone(node: QuoteNode): QuoteNode;
|
|
18
|
+
createDOM(config: EditorConfig): HTMLElement;
|
|
19
|
+
updateDOM(prevNode: this, dom: HTMLElement): boolean;
|
|
20
|
+
static importDOM(): DOMConversionMap | null;
|
|
21
|
+
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
|
22
|
+
static importJSON(serializedNode: SerializedQuoteNode): QuoteNode;
|
|
23
|
+
insertNewAfter(_: RangeSelection, restoreSelection?: boolean): ParagraphNode;
|
|
24
|
+
collapseAtStart(): true;
|
|
25
|
+
canMergeWhenEmpty(): true;
|
|
26
|
+
}
|
|
27
|
+
export declare function $createQuoteNode(): QuoteNode;
|
|
28
|
+
export declare function $isQuoteNode(node: LexicalNode | null | undefined): node is QuoteNode;
|
|
29
|
+
export type HeadingTagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
30
|
+
/** @noInheritDoc */
|
|
31
|
+
export declare class HeadingNode extends ElementNode {
|
|
32
|
+
/** @internal */
|
|
33
|
+
__tag: HeadingTagType;
|
|
34
|
+
static getType(): string;
|
|
35
|
+
static clone(node: HeadingNode): HeadingNode;
|
|
36
|
+
constructor(tag: HeadingTagType, key?: NodeKey);
|
|
37
|
+
getTag(): HeadingTagType;
|
|
38
|
+
setTag(tag: HeadingTagType): this;
|
|
39
|
+
createDOM(config: EditorConfig): HTMLElement;
|
|
40
|
+
updateDOM(prevNode: this, dom: HTMLElement, config: EditorConfig): boolean;
|
|
41
|
+
static importDOM(): DOMConversionMap | null;
|
|
42
|
+
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
|
43
|
+
static importJSON(serializedNode: SerializedHeadingNode): HeadingNode;
|
|
44
|
+
updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedHeadingNode>): this;
|
|
45
|
+
exportJSON(): SerializedHeadingNode;
|
|
46
|
+
insertNewAfter(selection?: RangeSelection, restoreSelection?: boolean): ParagraphNode | HeadingNode;
|
|
47
|
+
collapseAtStart(): true;
|
|
48
|
+
extractWithChild(): boolean;
|
|
49
|
+
}
|
|
50
|
+
export declare function $createHeadingNode(headingTag?: HeadingTagType): HeadingNode;
|
|
51
|
+
export declare function $isHeadingNode(node: LexicalNode | null | undefined): node is HeadingNode;
|
|
52
|
+
export declare function eventFiles(event: DragEvent | PasteCommandType): [boolean, Array<File>, boolean];
|
|
53
|
+
export declare function registerRichText(editor: LexicalEditor): () => void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// THIS FILE IS AUTO-GENERATED
|
|
2
|
+
// To regenerate, run: pnpm build (from the root of the project)
|
|
3
|
+
|
|
4
|
+
// Type definitions based on Lexical
|
|
5
|
+
// Original copyright: Meta Platforms, Inc. and affiliates.
|
|
6
|
+
|
|
7
|
+
import type { DOMConversionMap, DOMConversionOutput, DOMExportOutput, EditorConfig, LexicalEditor, LexicalNode, LexicalUpdateJSON, NodeKey, SerializedElementNode, Spread } from './../';
|
|
8
|
+
import { ElementNode } from './../';
|
|
9
|
+
export declare const TableCellHeaderStates: {
|
|
10
|
+
BOTH: number;
|
|
11
|
+
COLUMN: number;
|
|
12
|
+
NO_STATUS: number;
|
|
13
|
+
ROW: number;
|
|
14
|
+
};
|
|
15
|
+
export type TableCellHeaderState = (typeof TableCellHeaderStates)[keyof typeof TableCellHeaderStates];
|
|
16
|
+
export type SerializedTableCellNode = Spread<{
|
|
17
|
+
colSpan?: number;
|
|
18
|
+
rowSpan?: number;
|
|
19
|
+
headerState: TableCellHeaderState;
|
|
20
|
+
width?: number;
|
|
21
|
+
backgroundColor?: null | string;
|
|
22
|
+
verticalAlign?: string;
|
|
23
|
+
}, SerializedElementNode>;
|
|
24
|
+
/** @noInheritDoc */
|
|
25
|
+
export declare class TableCellNode extends ElementNode {
|
|
26
|
+
/** @internal */
|
|
27
|
+
__colSpan: number;
|
|
28
|
+
/** @internal */
|
|
29
|
+
__rowSpan: number;
|
|
30
|
+
/** @internal */
|
|
31
|
+
__headerState: TableCellHeaderState;
|
|
32
|
+
/** @internal */
|
|
33
|
+
__width?: number | undefined;
|
|
34
|
+
/** @internal */
|
|
35
|
+
__backgroundColor: null | string;
|
|
36
|
+
/** @internal */
|
|
37
|
+
__verticalAlign?: undefined | string;
|
|
38
|
+
static getType(): string;
|
|
39
|
+
static clone(node: TableCellNode): TableCellNode;
|
|
40
|
+
afterCloneFrom(node: this): void;
|
|
41
|
+
static importDOM(): DOMConversionMap | null;
|
|
42
|
+
static importJSON(serializedNode: SerializedTableCellNode): TableCellNode;
|
|
43
|
+
updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedTableCellNode>): this;
|
|
44
|
+
constructor(headerState?: number, colSpan?: number, width?: number, key?: NodeKey);
|
|
45
|
+
createDOM(config: EditorConfig): HTMLTableCellElement;
|
|
46
|
+
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
|
47
|
+
exportJSON(): SerializedTableCellNode;
|
|
48
|
+
getColSpan(): number;
|
|
49
|
+
setColSpan(colSpan: number): this;
|
|
50
|
+
getRowSpan(): number;
|
|
51
|
+
setRowSpan(rowSpan: number): this;
|
|
52
|
+
getTag(): 'th' | 'td';
|
|
53
|
+
setHeaderStyles(headerState: TableCellHeaderState, mask?: TableCellHeaderState): this;
|
|
54
|
+
getHeaderStyles(): TableCellHeaderState;
|
|
55
|
+
setWidth(width: number | undefined): this;
|
|
56
|
+
getWidth(): number | undefined;
|
|
57
|
+
getBackgroundColor(): null | string;
|
|
58
|
+
setBackgroundColor(newBackgroundColor: null | string): this;
|
|
59
|
+
getVerticalAlign(): undefined | string;
|
|
60
|
+
setVerticalAlign(newVerticalAlign: null | undefined | string): this;
|
|
61
|
+
toggleHeaderStyle(headerStateToToggle: TableCellHeaderState): this;
|
|
62
|
+
hasHeaderState(headerState: TableCellHeaderState): boolean;
|
|
63
|
+
hasHeader(): boolean;
|
|
64
|
+
updateDOM(prevNode: this): boolean;
|
|
65
|
+
isShadowRoot(): boolean;
|
|
66
|
+
collapseAtStart(): true;
|
|
67
|
+
canBeEmpty(): false;
|
|
68
|
+
canIndent(): false;
|
|
69
|
+
}
|
|
70
|
+
export declare function $convertTableCellNodeElement(domNode: Node): DOMConversionOutput;
|
|
71
|
+
export declare function $createTableCellNode(headerState?: TableCellHeaderState, colSpan?: number, width?: number): TableCellNode;
|
|
72
|
+
export declare function $isTableCellNode(node: LexicalNode | null | undefined): node is TableCellNode;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// THIS FILE IS AUTO-GENERATED
|
|
2
|
+
// To regenerate, run: pnpm build (from the root of the project)
|
|
3
|
+
|
|
4
|
+
// Type definitions based on Lexical
|
|
5
|
+
// Original copyright: Meta Platforms, Inc. and affiliates.
|
|
6
|
+
|
|
7
|
+
import type { LexicalCommand } from './../';
|
|
8
|
+
export type InsertTableCommandPayloadHeaders = Readonly<{
|
|
9
|
+
rows: boolean;
|
|
10
|
+
columns: boolean;
|
|
11
|
+
}> | boolean;
|
|
12
|
+
export type InsertTableCommandPayload = Readonly<{
|
|
13
|
+
columns: string;
|
|
14
|
+
rows: string;
|
|
15
|
+
includeHeaders?: InsertTableCommandPayloadHeaders;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const INSERT_TABLE_COMMAND: LexicalCommand<InsertTableCommandPayload>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// THIS FILE IS AUTO-GENERATED
|
|
2
|
+
// To regenerate, run: pnpm build (from the root of the project)
|
|
3
|
+
|
|
4
|
+
// Type definitions based on Lexical
|
|
5
|
+
// Original copyright: Meta Platforms, Inc. and affiliates.
|
|
6
|
+
|
|
7
|
+
import { BaseSelection, DOMConversionMap, DOMConversionOutput, DOMExportOutput, EditorConfig, ElementDOMSlot, ElementNode, LexicalEditor, LexicalNode, LexicalUpdateJSON, NodeKey, SerializedElementNode, Spread } from './../';
|
|
8
|
+
import { type TableCellNode } from './LexicalTableCellNode';
|
|
9
|
+
import { TableDOMCell, TableDOMTable } from './LexicalTableObserver';
|
|
10
|
+
export type SerializedTableNode = Spread<{
|
|
11
|
+
colWidths?: readonly number[];
|
|
12
|
+
rowStriping?: boolean;
|
|
13
|
+
frozenColumnCount?: number;
|
|
14
|
+
frozenRowCount?: number;
|
|
15
|
+
}, SerializedElementNode>;
|
|
16
|
+
export declare function $isScrollableTablesActive(editor?: LexicalEditor): boolean;
|
|
17
|
+
export declare function setScrollableTablesActive(editor: LexicalEditor, active: boolean): void;
|
|
18
|
+
/** @noInheritDoc */
|
|
19
|
+
export declare class TableNode extends ElementNode {
|
|
20
|
+
/** @internal */
|
|
21
|
+
__rowStriping: boolean;
|
|
22
|
+
__frozenColumnCount: number;
|
|
23
|
+
__frozenRowCount: number;
|
|
24
|
+
__colWidths?: readonly number[];
|
|
25
|
+
static getType(): string;
|
|
26
|
+
getColWidths(): readonly number[] | undefined;
|
|
27
|
+
setColWidths(colWidths: readonly number[] | undefined): this;
|
|
28
|
+
static clone(node: TableNode): TableNode;
|
|
29
|
+
afterCloneFrom(prevNode: this): void;
|
|
30
|
+
static importDOM(): DOMConversionMap | null;
|
|
31
|
+
static importJSON(serializedNode: SerializedTableNode): TableNode;
|
|
32
|
+
updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedTableNode>): this;
|
|
33
|
+
constructor(key?: NodeKey);
|
|
34
|
+
exportJSON(): SerializedTableNode;
|
|
35
|
+
extractWithChild(child: LexicalNode, selection: BaseSelection | null, destination: 'clone' | 'html'): boolean;
|
|
36
|
+
getDOMSlot(element: HTMLElement): ElementDOMSlot<HTMLTableElement>;
|
|
37
|
+
createDOM(config: EditorConfig, editor?: LexicalEditor): HTMLElement;
|
|
38
|
+
updateTableWrapper(prevNode: this | null, tableWrapper: HTMLDivElement, tableElement: HTMLTableElement, config: EditorConfig): void;
|
|
39
|
+
updateTableElement(prevNode: this | null, tableElement: HTMLTableElement, config: EditorConfig): void;
|
|
40
|
+
updateDOM(prevNode: this, dom: HTMLElement, config: EditorConfig): boolean;
|
|
41
|
+
exportDOM(editor: LexicalEditor): DOMExportOutput;
|
|
42
|
+
canBeEmpty(): false;
|
|
43
|
+
isShadowRoot(): boolean;
|
|
44
|
+
getCordsFromCellNode(tableCellNode: TableCellNode, table: TableDOMTable): {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
};
|
|
48
|
+
getDOMCellFromCords(x: number, y: number, table: TableDOMTable): null | TableDOMCell;
|
|
49
|
+
getDOMCellFromCordsOrThrow(x: number, y: number, table: TableDOMTable): TableDOMCell;
|
|
50
|
+
getCellNodeFromCords(x: number, y: number, table: TableDOMTable): null | TableCellNode;
|
|
51
|
+
getCellNodeFromCordsOrThrow(x: number, y: number, table: TableDOMTable): TableCellNode;
|
|
52
|
+
getRowStriping(): boolean;
|
|
53
|
+
setRowStriping(newRowStriping: boolean): this;
|
|
54
|
+
setFrozenColumns(columnCount: number): this;
|
|
55
|
+
getFrozenColumns(): number;
|
|
56
|
+
setFrozenRows(rowCount: number): this;
|
|
57
|
+
getFrozenRows(): number;
|
|
58
|
+
canSelectBefore(): true;
|
|
59
|
+
canIndent(): false;
|
|
60
|
+
getColumnCount(): number;
|
|
61
|
+
}
|
|
62
|
+
export declare function $getElementForTableNode(editor: LexicalEditor, tableNode: TableNode): TableDOMTable;
|
|
63
|
+
export declare function $convertTableElement(domNode: HTMLElement): DOMConversionOutput;
|
|
64
|
+
export declare function $createTableNode(): TableNode;
|
|
65
|
+
export declare function $isTableNode(node: LexicalNode | null | undefined): node is TableNode;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// THIS FILE IS AUTO-GENERATED
|
|
2
|
+
// To regenerate, run: pnpm build (from the root of the project)
|
|
3
|
+
|
|
4
|
+
// Type definitions based on Lexical
|
|
5
|
+
// Original copyright: Meta Platforms, Inc. and affiliates.
|
|
6
|
+
|
|
7
|
+
import type { LexicalEditor, NodeKey, TextFormatType } from './../';
|
|
8
|
+
import { TableCellNode } from './LexicalTableCellNode';
|
|
9
|
+
import { TableNode } from './LexicalTableNode';
|
|
10
|
+
import { type TableSelection } from './LexicalTableSelection';
|
|
11
|
+
import { HTMLTableElementWithWithTableSelectionState } from './LexicalTableSelectionHelpers';
|
|
12
|
+
export type TableDOMCell = {
|
|
13
|
+
elem: HTMLElement;
|
|
14
|
+
highlighted: boolean;
|
|
15
|
+
hasBackgroundColor: boolean;
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
};
|
|
19
|
+
export type TableDOMRows = Array<Array<TableDOMCell | undefined> | undefined>;
|
|
20
|
+
export type TableDOMTable = {
|
|
21
|
+
domRows: TableDOMRows;
|
|
22
|
+
columns: number;
|
|
23
|
+
rows: number;
|
|
24
|
+
};
|
|
25
|
+
export declare function $getTableAndElementByKey(tableNodeKey: NodeKey, editor?: LexicalEditor): {
|
|
26
|
+
tableNode: TableNode;
|
|
27
|
+
tableElement: HTMLTableElementWithWithTableSelectionState;
|
|
28
|
+
};
|
|
29
|
+
export declare class TableObserver {
|
|
30
|
+
focusX: number;
|
|
31
|
+
focusY: number;
|
|
32
|
+
listenersToRemove: Set<() => void>;
|
|
33
|
+
table: TableDOMTable;
|
|
34
|
+
isHighlightingCells: boolean;
|
|
35
|
+
anchorX: number;
|
|
36
|
+
anchorY: number;
|
|
37
|
+
tableNodeKey: NodeKey;
|
|
38
|
+
anchorCell: TableDOMCell | null;
|
|
39
|
+
focusCell: TableDOMCell | null;
|
|
40
|
+
anchorCellNodeKey: NodeKey | null;
|
|
41
|
+
focusCellNodeKey: NodeKey | null;
|
|
42
|
+
editor: LexicalEditor;
|
|
43
|
+
tableSelection: TableSelection | null;
|
|
44
|
+
hasHijackedSelectionStyles: boolean;
|
|
45
|
+
isSelecting: boolean;
|
|
46
|
+
pointerType: string | null;
|
|
47
|
+
shouldCheckSelection: boolean;
|
|
48
|
+
abortController: AbortController;
|
|
49
|
+
listenerOptions: {
|
|
50
|
+
signal: AbortSignal;
|
|
51
|
+
};
|
|
52
|
+
nextFocus: {
|
|
53
|
+
focusCell: TableDOMCell;
|
|
54
|
+
override: boolean;
|
|
55
|
+
} | null;
|
|
56
|
+
constructor(editor: LexicalEditor, tableNodeKey: string);
|
|
57
|
+
getTable(): TableDOMTable;
|
|
58
|
+
removeListeners(): void;
|
|
59
|
+
$lookup(): {
|
|
60
|
+
tableNode: TableNode;
|
|
61
|
+
tableElement: HTMLTableElementWithWithTableSelectionState;
|
|
62
|
+
};
|
|
63
|
+
trackTable(): void;
|
|
64
|
+
$clearHighlight(): void;
|
|
65
|
+
$enableHighlightStyle(): void;
|
|
66
|
+
$disableHighlightStyle(): void;
|
|
67
|
+
$updateTableTableSelection(selection: TableSelection | null): void;
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
* Firefox has a strange behavior where pressing the down arrow key from
|
|
71
|
+
* above the table will move the caret after the table and then lexical
|
|
72
|
+
* will select the last cell instead of the first.
|
|
73
|
+
* We do still want to let the browser handle caret movement but we will
|
|
74
|
+
* use this property to "tag" the update so that we can recheck the
|
|
75
|
+
* selection after the event is processed.
|
|
76
|
+
*/
|
|
77
|
+
setShouldCheckSelection(): void;
|
|
78
|
+
/**
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
getAndClearShouldCheckSelection(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* @internal
|
|
84
|
+
* When handling mousemove events we track what the focus cell should be, but
|
|
85
|
+
* the DOM selection may end up somewhere else entirely. We don't have an elegant
|
|
86
|
+
* way to handle this after the DOM selection has been resolved in a
|
|
87
|
+
* SELECTION_CHANGE_COMMAND callback.
|
|
88
|
+
*/
|
|
89
|
+
setNextFocus(nextFocus: null | {
|
|
90
|
+
focusCell: TableDOMCell;
|
|
91
|
+
override: boolean;
|
|
92
|
+
}): void;
|
|
93
|
+
/** @internal */
|
|
94
|
+
getAndClearNextFocus(): {
|
|
95
|
+
focusCell: TableDOMCell;
|
|
96
|
+
override: boolean;
|
|
97
|
+
} | null;
|
|
98
|
+
/** @internal */
|
|
99
|
+
updateDOMSelection(): void;
|
|
100
|
+
$setFocusCellForSelection(cell: TableDOMCell, ignoreStart?: boolean): boolean;
|
|
101
|
+
$getAnchorTableCell(): TableCellNode | null;
|
|
102
|
+
$getAnchorTableCellOrThrow(): TableCellNode;
|
|
103
|
+
$getFocusTableCell(): TableCellNode | null;
|
|
104
|
+
$getFocusTableCellOrThrow(): TableCellNode;
|
|
105
|
+
$setAnchorCellForSelection(cell: TableDOMCell): void;
|
|
106
|
+
$formatCells(type: TextFormatType): void;
|
|
107
|
+
$clearText(): void;
|
|
108
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// THIS FILE IS AUTO-GENERATED
|
|
2
|
+
// To regenerate, run: pnpm build (from the root of the project)
|
|
3
|
+
|
|
4
|
+
// Type definitions based on Lexical
|
|
5
|
+
// Original copyright: Meta Platforms, Inc. and affiliates.
|
|
6
|
+
|
|
7
|
+
import { LexicalEditor } from './../';
|
|
8
|
+
/**
|
|
9
|
+
* Register a transform to ensure that all TableCellNode have a colSpan and rowSpan of 1.
|
|
10
|
+
* This should only be registered when you do not want to support merged cells.
|
|
11
|
+
*
|
|
12
|
+
* @param editor The editor
|
|
13
|
+
* @returns An unregister callback
|
|
14
|
+
*/
|
|
15
|
+
export declare function registerTableCellUnmergeTransform(editor: LexicalEditor): () => void;
|
|
16
|
+
export declare function registerTableSelectionObserver(editor: LexicalEditor, hasTabHandler?: boolean): () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Register the INSERT_TABLE_COMMAND listener and the table integrity transforms. The
|
|
19
|
+
* table selection observer should be registered separately after this with
|
|
20
|
+
* {@link registerTableSelectionObserver}.
|
|
21
|
+
*
|
|
22
|
+
* @param editor The editor
|
|
23
|
+
* @returns An unregister callback
|
|
24
|
+
*/
|
|
25
|
+
export declare function registerTablePlugin(editor: LexicalEditor): () => void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// THIS FILE IS AUTO-GENERATED
|
|
2
|
+
// To regenerate, run: pnpm build (from the root of the project)
|
|
3
|
+
|
|
4
|
+
// Type definitions based on Lexical
|
|
5
|
+
// Original copyright: Meta Platforms, Inc. and affiliates.
|
|
6
|
+
|
|
7
|
+
import type { BaseSelection, LexicalUpdateJSON, Spread } from './../';
|
|
8
|
+
import { DOMConversionMap, DOMConversionOutput, EditorConfig, ElementNode, LexicalNode, NodeKey, SerializedElementNode } from './../';
|
|
9
|
+
export type SerializedTableRowNode = Spread<{
|
|
10
|
+
height?: number;
|
|
11
|
+
}, SerializedElementNode>;
|
|
12
|
+
/** @noInheritDoc */
|
|
13
|
+
export declare class TableRowNode extends ElementNode {
|
|
14
|
+
/** @internal */
|
|
15
|
+
__height?: number;
|
|
16
|
+
static getType(): string;
|
|
17
|
+
static clone(node: TableRowNode): TableRowNode;
|
|
18
|
+
static importDOM(): DOMConversionMap | null;
|
|
19
|
+
static importJSON(serializedNode: SerializedTableRowNode): TableRowNode;
|
|
20
|
+
updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedTableRowNode>): this;
|
|
21
|
+
constructor(height?: number, key?: NodeKey);
|
|
22
|
+
exportJSON(): SerializedTableRowNode;
|
|
23
|
+
createDOM(config: EditorConfig): HTMLElement;
|
|
24
|
+
extractWithChild(child: LexicalNode, selection: BaseSelection | null, destination: 'clone' | 'html'): boolean;
|
|
25
|
+
isShadowRoot(): boolean;
|
|
26
|
+
setHeight(height?: number | undefined): this;
|
|
27
|
+
getHeight(): number | undefined;
|
|
28
|
+
updateDOM(prevNode: this): boolean;
|
|
29
|
+
canBeEmpty(): false;
|
|
30
|
+
canIndent(): false;
|
|
31
|
+
}
|
|
32
|
+
export declare function $convertTableRowElement(domNode: Node): DOMConversionOutput;
|
|
33
|
+
export declare function $createTableRowNode(height?: number): TableRowNode;
|
|
34
|
+
export declare function $isTableRowNode(node: LexicalNode | null | undefined): node is TableRowNode;
|