@docen/extensions 0.0.8
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 +21 -0
- package/README.md +315 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +72 -0
- package/dist/index.d.mts +72 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.mjs +1 -0
- package/dist/shared/extensions.BED3A2H3.d.ts +1793 -0
- package/dist/shared/extensions.BQfevE5S.d.cts +1793 -0
- package/dist/shared/extensions.CcSIv21B.cjs +72 -0
- package/dist/shared/extensions.Chtjfo3m.mjs +72 -0
- package/dist/shared/extensions.DAZn2HEU.d.mts +1793 -0
- package/dist/shared/extensions.SlCx0Bmn.d.cts +6596 -0
- package/dist/shared/extensions.SlCx0Bmn.d.mts +6596 -0
- package/dist/shared/extensions.SlCx0Bmn.d.ts +6596 -0
- package/dist/tiptap.cjs +1 -0
- package/dist/tiptap.d.cts +3 -0
- package/dist/tiptap.d.mts +3 -0
- package/dist/tiptap.d.ts +3 -0
- package/dist/tiptap.mjs +1 -0
- package/dist/types.cjs +1 -0
- package/dist/types.d.cts +385 -0
- package/dist/types.d.mts +385 -0
- package/dist/types.d.ts +385 -0
- package/dist/types.mjs +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,1793 @@
|
|
|
1
|
+
import { N as Node, a as Node$1, P as ParentConfig, b as EditorView, c as NodeView, R as ResizableNodeViewDirection, d as PluginKey, e as Editor, f as Range, g as EditorState, h as ResolvedPos, D as DOMOutputSpec, M as Mark, i as Extension } from './extensions.SlCx0Bmn.cjs';
|
|
2
|
+
import '@tiptap/extension-mathematics';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The default document node which represents the top level node of the editor.
|
|
6
|
+
* @see https://tiptap.dev/api/nodes/document
|
|
7
|
+
*/
|
|
8
|
+
declare const Document: Node<any, any>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This extension allows you to create text nodes.
|
|
12
|
+
* @see https://www.tiptap.dev/api/nodes/text
|
|
13
|
+
*/
|
|
14
|
+
declare const Text: Node<any, any>;
|
|
15
|
+
|
|
16
|
+
interface ParagraphOptions {
|
|
17
|
+
/**
|
|
18
|
+
* The HTML attributes for a paragraph node.
|
|
19
|
+
* @default {}
|
|
20
|
+
* @example { class: 'foo' }
|
|
21
|
+
*/
|
|
22
|
+
HTMLAttributes: Record<string, any>;
|
|
23
|
+
}
|
|
24
|
+
declare module '@tiptap/core' {
|
|
25
|
+
interface Commands<ReturnType> {
|
|
26
|
+
paragraph: {
|
|
27
|
+
/**
|
|
28
|
+
* Toggle a paragraph
|
|
29
|
+
* @example editor.commands.toggleParagraph()
|
|
30
|
+
*/
|
|
31
|
+
setParagraph: () => ReturnType;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* This extension allows you to create paragraphs.
|
|
37
|
+
* @see https://www.tiptap.dev/api/nodes/paragraph
|
|
38
|
+
*/
|
|
39
|
+
declare const Paragraph: Node<ParagraphOptions, any>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The heading level options.
|
|
43
|
+
*/
|
|
44
|
+
type Level = 1 | 2 | 3 | 4 | 5 | 6;
|
|
45
|
+
interface HeadingOptions {
|
|
46
|
+
/**
|
|
47
|
+
* The available heading levels.
|
|
48
|
+
* @default [1, 2, 3, 4, 5, 6]
|
|
49
|
+
* @example [1, 2, 3]
|
|
50
|
+
*/
|
|
51
|
+
levels: Level[];
|
|
52
|
+
/**
|
|
53
|
+
* The HTML attributes for a heading node.
|
|
54
|
+
* @default {}
|
|
55
|
+
* @example { class: 'foo' }
|
|
56
|
+
*/
|
|
57
|
+
HTMLAttributes: Record<string, any>;
|
|
58
|
+
}
|
|
59
|
+
declare module '@tiptap/core' {
|
|
60
|
+
interface Commands<ReturnType> {
|
|
61
|
+
heading: {
|
|
62
|
+
/**
|
|
63
|
+
* Set a heading node
|
|
64
|
+
* @param attributes The heading attributes
|
|
65
|
+
* @example editor.commands.setHeading({ level: 1 })
|
|
66
|
+
*/
|
|
67
|
+
setHeading: (attributes: {
|
|
68
|
+
level: Level;
|
|
69
|
+
}) => ReturnType;
|
|
70
|
+
/**
|
|
71
|
+
* Toggle a heading node
|
|
72
|
+
* @param attributes The heading attributes
|
|
73
|
+
* @example editor.commands.toggleHeading({ level: 1 })
|
|
74
|
+
*/
|
|
75
|
+
toggleHeading: (attributes: {
|
|
76
|
+
level: Level;
|
|
77
|
+
}) => ReturnType;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* This extension allows you to create headings.
|
|
83
|
+
* @see https://www.tiptap.dev/api/nodes/heading
|
|
84
|
+
*/
|
|
85
|
+
declare const Heading: Node<HeadingOptions, any>;
|
|
86
|
+
|
|
87
|
+
/** @jsxImportSource @tiptap/core */
|
|
88
|
+
|
|
89
|
+
interface BlockquoteOptions {
|
|
90
|
+
/**
|
|
91
|
+
* HTML attributes to add to the blockquote element
|
|
92
|
+
* @default {}
|
|
93
|
+
* @example { class: 'foo' }
|
|
94
|
+
*/
|
|
95
|
+
HTMLAttributes: Record<string, any>;
|
|
96
|
+
}
|
|
97
|
+
declare module '@tiptap/core' {
|
|
98
|
+
interface Commands<ReturnType> {
|
|
99
|
+
blockQuote: {
|
|
100
|
+
/**
|
|
101
|
+
* Set a blockquote node
|
|
102
|
+
*/
|
|
103
|
+
setBlockquote: () => ReturnType;
|
|
104
|
+
/**
|
|
105
|
+
* Toggle a blockquote node
|
|
106
|
+
*/
|
|
107
|
+
toggleBlockquote: () => ReturnType;
|
|
108
|
+
/**
|
|
109
|
+
* Unset a blockquote node
|
|
110
|
+
*/
|
|
111
|
+
unsetBlockquote: () => ReturnType;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* This extension allows you to create blockquotes.
|
|
117
|
+
* @see https://tiptap.dev/api/nodes/blockquote
|
|
118
|
+
*/
|
|
119
|
+
declare const Blockquote: Node<BlockquoteOptions, any>;
|
|
120
|
+
|
|
121
|
+
interface HorizontalRuleOptions {
|
|
122
|
+
/**
|
|
123
|
+
* The HTML attributes for a horizontal rule node.
|
|
124
|
+
* @default {}
|
|
125
|
+
* @example { class: 'foo' }
|
|
126
|
+
*/
|
|
127
|
+
HTMLAttributes: Record<string, any>;
|
|
128
|
+
/**
|
|
129
|
+
* The default type to insert after the horizontal rule.
|
|
130
|
+
* @default "paragraph"
|
|
131
|
+
* @example "heading"
|
|
132
|
+
*/
|
|
133
|
+
nextNodeType: string;
|
|
134
|
+
}
|
|
135
|
+
declare module '@tiptap/core' {
|
|
136
|
+
interface Commands<ReturnType> {
|
|
137
|
+
horizontalRule: {
|
|
138
|
+
/**
|
|
139
|
+
* Add a horizontal rule
|
|
140
|
+
* @example editor.commands.setHorizontalRule()
|
|
141
|
+
*/
|
|
142
|
+
setHorizontalRule: () => ReturnType;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* This extension allows you to insert horizontal rules.
|
|
148
|
+
* @see https://www.tiptap.dev/api/nodes/horizontal-rule
|
|
149
|
+
*/
|
|
150
|
+
declare const HorizontalRule: Node<HorizontalRuleOptions, any>;
|
|
151
|
+
|
|
152
|
+
interface CodeBlockOptions {
|
|
153
|
+
/**
|
|
154
|
+
* Adds a prefix to language classes that are applied to code tags.
|
|
155
|
+
* @default 'language-'
|
|
156
|
+
*/
|
|
157
|
+
languageClassPrefix: string | null | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Define whether the node should be exited on triple enter.
|
|
160
|
+
* @default true
|
|
161
|
+
*/
|
|
162
|
+
exitOnTripleEnter: boolean | null | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* Define whether the node should be exited on arrow down if there is no node after it.
|
|
165
|
+
* @default true
|
|
166
|
+
*/
|
|
167
|
+
exitOnArrowDown: boolean | null | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* The default language.
|
|
170
|
+
* @default null
|
|
171
|
+
* @example 'js'
|
|
172
|
+
*/
|
|
173
|
+
defaultLanguage: string | null | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Enable tab key for indentation in code blocks.
|
|
176
|
+
* @default false
|
|
177
|
+
*/
|
|
178
|
+
enableTabIndentation: boolean | null | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* The number of spaces to use for tab indentation.
|
|
181
|
+
* @default 4
|
|
182
|
+
*/
|
|
183
|
+
tabSize: number | null | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Custom HTML attributes that should be added to the rendered HTML tag.
|
|
186
|
+
* @default {}
|
|
187
|
+
* @example { class: 'foo' }
|
|
188
|
+
*/
|
|
189
|
+
HTMLAttributes: Record<string, any>;
|
|
190
|
+
}
|
|
191
|
+
declare module '@tiptap/core' {
|
|
192
|
+
interface Commands<ReturnType> {
|
|
193
|
+
codeBlock: {
|
|
194
|
+
/**
|
|
195
|
+
* Set a code block
|
|
196
|
+
* @param attributes Code block attributes
|
|
197
|
+
* @example editor.commands.setCodeBlock({ language: 'javascript' })
|
|
198
|
+
*/
|
|
199
|
+
setCodeBlock: (attributes?: {
|
|
200
|
+
language: string;
|
|
201
|
+
}) => ReturnType;
|
|
202
|
+
/**
|
|
203
|
+
* Toggle a code block
|
|
204
|
+
* @param attributes Code block attributes
|
|
205
|
+
* @example editor.commands.toggleCodeBlock({ language: 'javascript' })
|
|
206
|
+
*/
|
|
207
|
+
toggleCodeBlock: (attributes?: {
|
|
208
|
+
language: string;
|
|
209
|
+
}) => ReturnType;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
interface CodeBlockLowlightOptions extends CodeBlockOptions {
|
|
215
|
+
/**
|
|
216
|
+
* The lowlight instance.
|
|
217
|
+
*/
|
|
218
|
+
lowlight: any;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* This extension allows you to highlight code blocks with lowlight.
|
|
222
|
+
* @see https://tiptap.dev/api/nodes/code-block-lowlight
|
|
223
|
+
*/
|
|
224
|
+
declare const CodeBlockLowlight: Node<CodeBlockLowlightOptions, any>;
|
|
225
|
+
|
|
226
|
+
interface BulletListOptions {
|
|
227
|
+
/**
|
|
228
|
+
* The node name for the list items
|
|
229
|
+
* @default 'listItem'
|
|
230
|
+
* @example 'paragraph'
|
|
231
|
+
*/
|
|
232
|
+
itemTypeName: string;
|
|
233
|
+
/**
|
|
234
|
+
* HTML attributes to add to the bullet list element
|
|
235
|
+
* @default {}
|
|
236
|
+
* @example { class: 'foo' }
|
|
237
|
+
*/
|
|
238
|
+
HTMLAttributes: Record<string, any>;
|
|
239
|
+
/**
|
|
240
|
+
* Keep the marks when splitting the list
|
|
241
|
+
* @default false
|
|
242
|
+
* @example true
|
|
243
|
+
*/
|
|
244
|
+
keepMarks: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Keep the attributes when splitting the list
|
|
247
|
+
* @default false
|
|
248
|
+
* @example true
|
|
249
|
+
*/
|
|
250
|
+
keepAttributes: boolean;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* This extension allows you to create bullet lists.
|
|
254
|
+
* This requires the ListItem extension
|
|
255
|
+
* @see https://tiptap.dev/api/nodes/bullet-list
|
|
256
|
+
* @see https://tiptap.dev/api/nodes/list-item.
|
|
257
|
+
*/
|
|
258
|
+
declare const BulletList: Node<BulletListOptions, any>;
|
|
259
|
+
|
|
260
|
+
interface ListItemOptions {
|
|
261
|
+
/**
|
|
262
|
+
* The HTML attributes for a list item node.
|
|
263
|
+
* @default {}
|
|
264
|
+
* @example { class: 'foo' }
|
|
265
|
+
*/
|
|
266
|
+
HTMLAttributes: Record<string, any>;
|
|
267
|
+
/**
|
|
268
|
+
* The node type for bulletList nodes
|
|
269
|
+
* @default 'bulletList'
|
|
270
|
+
* @example 'myCustomBulletList'
|
|
271
|
+
*/
|
|
272
|
+
bulletListTypeName: string;
|
|
273
|
+
/**
|
|
274
|
+
* The node type for orderedList nodes
|
|
275
|
+
* @default 'orderedList'
|
|
276
|
+
* @example 'myCustomOrderedList'
|
|
277
|
+
*/
|
|
278
|
+
orderedListTypeName: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* This extension allows you to create list items.
|
|
282
|
+
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
283
|
+
*/
|
|
284
|
+
declare const ListItem: Node<ListItemOptions, any>;
|
|
285
|
+
|
|
286
|
+
interface OrderedListOptions {
|
|
287
|
+
/**
|
|
288
|
+
* The node type name for list items.
|
|
289
|
+
* @default 'listItem'
|
|
290
|
+
* @example 'myListItem'
|
|
291
|
+
*/
|
|
292
|
+
itemTypeName: string;
|
|
293
|
+
/**
|
|
294
|
+
* The HTML attributes for an ordered list node.
|
|
295
|
+
* @default {}
|
|
296
|
+
* @example { class: 'foo' }
|
|
297
|
+
*/
|
|
298
|
+
HTMLAttributes: Record<string, any>;
|
|
299
|
+
/**
|
|
300
|
+
* Keep the marks when splitting a list item.
|
|
301
|
+
* @default false
|
|
302
|
+
* @example true
|
|
303
|
+
*/
|
|
304
|
+
keepMarks: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Keep the attributes when splitting a list item.
|
|
307
|
+
* @default false
|
|
308
|
+
* @example true
|
|
309
|
+
*/
|
|
310
|
+
keepAttributes: boolean;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* This extension allows you to create ordered lists.
|
|
314
|
+
* This requires the ListItem extension
|
|
315
|
+
* @see https://www.tiptap.dev/api/nodes/ordered-list
|
|
316
|
+
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
317
|
+
*/
|
|
318
|
+
declare const OrderedList: Node<OrderedListOptions, any>;
|
|
319
|
+
|
|
320
|
+
interface TaskItemOptions {
|
|
321
|
+
/**
|
|
322
|
+
* A callback function that is called when the checkbox is clicked while the editor is in readonly mode.
|
|
323
|
+
* @param node The prosemirror node of the task item
|
|
324
|
+
* @param checked The new checked state
|
|
325
|
+
* @returns boolean
|
|
326
|
+
*/
|
|
327
|
+
onReadOnlyChecked?: (node: Node$1, checked: boolean) => boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Controls whether the task items can be nested or not.
|
|
330
|
+
* @default false
|
|
331
|
+
* @example true
|
|
332
|
+
*/
|
|
333
|
+
nested: boolean;
|
|
334
|
+
/**
|
|
335
|
+
* HTML attributes to add to the task item element.
|
|
336
|
+
* @default {}
|
|
337
|
+
* @example { class: 'foo' }
|
|
338
|
+
*/
|
|
339
|
+
HTMLAttributes: Record<string, any>;
|
|
340
|
+
/**
|
|
341
|
+
* The node type for taskList nodes
|
|
342
|
+
* @default 'taskList'
|
|
343
|
+
* @example 'myCustomTaskList'
|
|
344
|
+
*/
|
|
345
|
+
taskListTypeName: string;
|
|
346
|
+
/**
|
|
347
|
+
* Accessibility options for the task item.
|
|
348
|
+
* @default {}
|
|
349
|
+
* @example
|
|
350
|
+
* ```js
|
|
351
|
+
* {
|
|
352
|
+
* checkboxLabel: (node) => `Task item: ${node.textContent || 'empty task item'}`
|
|
353
|
+
* }
|
|
354
|
+
*/
|
|
355
|
+
a11y?: {
|
|
356
|
+
checkboxLabel?: (node: Node$1, checked: boolean) => string;
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* This extension allows you to create task items.
|
|
361
|
+
* @see https://www.tiptap.dev/api/nodes/task-item
|
|
362
|
+
*/
|
|
363
|
+
declare const TaskItem: Node<TaskItemOptions, any>;
|
|
364
|
+
|
|
365
|
+
interface TaskListOptions {
|
|
366
|
+
/**
|
|
367
|
+
* The node type name for a task item.
|
|
368
|
+
* @default 'taskItem'
|
|
369
|
+
* @example 'myCustomTaskItem'
|
|
370
|
+
*/
|
|
371
|
+
itemTypeName: string;
|
|
372
|
+
/**
|
|
373
|
+
* The HTML attributes for a task list node.
|
|
374
|
+
* @default {}
|
|
375
|
+
* @example { class: 'foo' }
|
|
376
|
+
*/
|
|
377
|
+
HTMLAttributes: Record<string, any>;
|
|
378
|
+
}
|
|
379
|
+
declare module '@tiptap/core' {
|
|
380
|
+
interface Commands<ReturnType> {
|
|
381
|
+
bulletList: {
|
|
382
|
+
/**
|
|
383
|
+
* Toggle a bullet list
|
|
384
|
+
*/
|
|
385
|
+
toggleBulletList: () => ReturnType;
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
declare module '@tiptap/core' {
|
|
390
|
+
interface Commands<ReturnType> {
|
|
391
|
+
orderedList: {
|
|
392
|
+
/**
|
|
393
|
+
* Toggle an ordered list
|
|
394
|
+
* @example editor.commands.toggleOrderedList()
|
|
395
|
+
*/
|
|
396
|
+
toggleOrderedList: () => ReturnType;
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
declare module '@tiptap/core' {
|
|
401
|
+
interface Commands<ReturnType> {
|
|
402
|
+
taskList: {
|
|
403
|
+
/**
|
|
404
|
+
* Toggle a task list
|
|
405
|
+
* @example editor.commands.toggleTaskList()
|
|
406
|
+
*/
|
|
407
|
+
toggleTaskList: () => ReturnType;
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* This extension allows you to create task lists.
|
|
413
|
+
* @see https://www.tiptap.dev/api/nodes/task-list
|
|
414
|
+
*/
|
|
415
|
+
declare const TaskList: Node<TaskListOptions, any>;
|
|
416
|
+
|
|
417
|
+
interface TableCellOptions {
|
|
418
|
+
/**
|
|
419
|
+
* The HTML attributes for a table cell node.
|
|
420
|
+
* @default {}
|
|
421
|
+
* @example { class: 'foo' }
|
|
422
|
+
*/
|
|
423
|
+
HTMLAttributes: Record<string, any>;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* This extension allows you to create table cells.
|
|
427
|
+
* @see https://www.tiptap.dev/api/nodes/table-cell
|
|
428
|
+
*/
|
|
429
|
+
declare const TableCell: Node<TableCellOptions, any>;
|
|
430
|
+
|
|
431
|
+
interface TableHeaderOptions {
|
|
432
|
+
/**
|
|
433
|
+
* The HTML attributes for a table header node.
|
|
434
|
+
* @default {}
|
|
435
|
+
* @example { class: 'foo' }
|
|
436
|
+
*/
|
|
437
|
+
HTMLAttributes: Record<string, any>;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* This extension allows you to create table headers.
|
|
441
|
+
* @see https://www.tiptap.dev/api/nodes/table-header
|
|
442
|
+
*/
|
|
443
|
+
declare const TableHeader: Node<TableHeaderOptions, any>;
|
|
444
|
+
|
|
445
|
+
interface TableRowOptions {
|
|
446
|
+
/**
|
|
447
|
+
* The HTML attributes for a table row node.
|
|
448
|
+
* @default {}
|
|
449
|
+
* @example { class: 'foo' }
|
|
450
|
+
*/
|
|
451
|
+
HTMLAttributes: Record<string, any>;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* This extension allows you to create table rows.
|
|
455
|
+
* @see https://www.tiptap.dev/api/nodes/table-row
|
|
456
|
+
*/
|
|
457
|
+
declare const TableRow: Node<TableRowOptions, any>;
|
|
458
|
+
|
|
459
|
+
interface TableOptions {
|
|
460
|
+
/**
|
|
461
|
+
* HTML attributes for the table element.
|
|
462
|
+
* @default {}
|
|
463
|
+
* @example { class: 'foo' }
|
|
464
|
+
*/
|
|
465
|
+
HTMLAttributes: Record<string, any>;
|
|
466
|
+
/**
|
|
467
|
+
* Enables the resizing of tables.
|
|
468
|
+
* @default false
|
|
469
|
+
* @example true
|
|
470
|
+
*/
|
|
471
|
+
resizable: boolean;
|
|
472
|
+
/**
|
|
473
|
+
* Controls whether the table should be wrapped in a div with class "tableWrapper" when rendered.
|
|
474
|
+
* In editable mode with resizable tables, this wrapper is always present via TableView.
|
|
475
|
+
* @default false
|
|
476
|
+
* @example true
|
|
477
|
+
*/
|
|
478
|
+
renderWrapper: boolean;
|
|
479
|
+
/**
|
|
480
|
+
* The width of the resize handle.
|
|
481
|
+
* @default 5
|
|
482
|
+
* @example 10
|
|
483
|
+
*/
|
|
484
|
+
handleWidth: number;
|
|
485
|
+
/**
|
|
486
|
+
* The minimum width of a cell.
|
|
487
|
+
* @default 25
|
|
488
|
+
* @example 50
|
|
489
|
+
*/
|
|
490
|
+
cellMinWidth: number;
|
|
491
|
+
/**
|
|
492
|
+
* The node view to render the table.
|
|
493
|
+
* @default TableView
|
|
494
|
+
*/
|
|
495
|
+
View: (new (node: Node$1, cellMinWidth: number, view: EditorView) => NodeView) | null;
|
|
496
|
+
/**
|
|
497
|
+
* Enables the resizing of the last column.
|
|
498
|
+
* @default true
|
|
499
|
+
* @example false
|
|
500
|
+
*/
|
|
501
|
+
lastColumnResizable: boolean;
|
|
502
|
+
/**
|
|
503
|
+
* Allow table node selection.
|
|
504
|
+
* @default false
|
|
505
|
+
* @example true
|
|
506
|
+
*/
|
|
507
|
+
allowTableNodeSelection: boolean;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
declare module '@tiptap/core' {
|
|
511
|
+
interface NodeConfig<Options, Storage> {
|
|
512
|
+
/**
|
|
513
|
+
* A string or function to determine the role of the table.
|
|
514
|
+
* @default 'table'
|
|
515
|
+
* @example () => 'table'
|
|
516
|
+
*/
|
|
517
|
+
tableRole?: string | ((this: {
|
|
518
|
+
name: string;
|
|
519
|
+
options: Options;
|
|
520
|
+
storage: Storage;
|
|
521
|
+
parent: ParentConfig<NodeConfig<Options>>['tableRole'];
|
|
522
|
+
}) => string);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
declare module '@tiptap/core' {
|
|
526
|
+
interface Commands<ReturnType> {
|
|
527
|
+
table: {
|
|
528
|
+
/**
|
|
529
|
+
* Insert a table
|
|
530
|
+
* @param options The table attributes
|
|
531
|
+
* @returns True if the command was successful, otherwise false
|
|
532
|
+
* @example editor.commands.insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
533
|
+
*/
|
|
534
|
+
insertTable: (options?: {
|
|
535
|
+
rows?: number;
|
|
536
|
+
cols?: number;
|
|
537
|
+
withHeaderRow?: boolean;
|
|
538
|
+
}) => ReturnType;
|
|
539
|
+
/**
|
|
540
|
+
* Add a column before the current column
|
|
541
|
+
* @returns True if the command was successful, otherwise false
|
|
542
|
+
* @example editor.commands.addColumnBefore()
|
|
543
|
+
*/
|
|
544
|
+
addColumnBefore: () => ReturnType;
|
|
545
|
+
/**
|
|
546
|
+
* Add a column after the current column
|
|
547
|
+
* @returns True if the command was successful, otherwise false
|
|
548
|
+
* @example editor.commands.addColumnAfter()
|
|
549
|
+
*/
|
|
550
|
+
addColumnAfter: () => ReturnType;
|
|
551
|
+
/**
|
|
552
|
+
* Delete the current column
|
|
553
|
+
* @returns True if the command was successful, otherwise false
|
|
554
|
+
* @example editor.commands.deleteColumn()
|
|
555
|
+
*/
|
|
556
|
+
deleteColumn: () => ReturnType;
|
|
557
|
+
/**
|
|
558
|
+
* Add a row before the current row
|
|
559
|
+
* @returns True if the command was successful, otherwise false
|
|
560
|
+
* @example editor.commands.addRowBefore()
|
|
561
|
+
*/
|
|
562
|
+
addRowBefore: () => ReturnType;
|
|
563
|
+
/**
|
|
564
|
+
* Add a row after the current row
|
|
565
|
+
* @returns True if the command was successful, otherwise false
|
|
566
|
+
* @example editor.commands.addRowAfter()
|
|
567
|
+
*/
|
|
568
|
+
addRowAfter: () => ReturnType;
|
|
569
|
+
/**
|
|
570
|
+
* Delete the current row
|
|
571
|
+
* @returns True if the command was successful, otherwise false
|
|
572
|
+
* @example editor.commands.deleteRow()
|
|
573
|
+
*/
|
|
574
|
+
deleteRow: () => ReturnType;
|
|
575
|
+
/**
|
|
576
|
+
* Delete the current table
|
|
577
|
+
* @returns True if the command was successful, otherwise false
|
|
578
|
+
* @example editor.commands.deleteTable()
|
|
579
|
+
*/
|
|
580
|
+
deleteTable: () => ReturnType;
|
|
581
|
+
/**
|
|
582
|
+
* Merge the currently selected cells
|
|
583
|
+
* @returns True if the command was successful, otherwise false
|
|
584
|
+
* @example editor.commands.mergeCells()
|
|
585
|
+
*/
|
|
586
|
+
mergeCells: () => ReturnType;
|
|
587
|
+
/**
|
|
588
|
+
* Split the currently selected cell
|
|
589
|
+
* @returns True if the command was successful, otherwise false
|
|
590
|
+
* @example editor.commands.splitCell()
|
|
591
|
+
*/
|
|
592
|
+
splitCell: () => ReturnType;
|
|
593
|
+
/**
|
|
594
|
+
* Toggle the header column
|
|
595
|
+
* @returns True if the command was successful, otherwise false
|
|
596
|
+
* @example editor.commands.toggleHeaderColumn()
|
|
597
|
+
*/
|
|
598
|
+
toggleHeaderColumn: () => ReturnType;
|
|
599
|
+
/**
|
|
600
|
+
* Toggle the header row
|
|
601
|
+
* @returns True if the command was successful, otherwise false
|
|
602
|
+
* @example editor.commands.toggleHeaderRow()
|
|
603
|
+
*/
|
|
604
|
+
toggleHeaderRow: () => ReturnType;
|
|
605
|
+
/**
|
|
606
|
+
* Toggle the header cell
|
|
607
|
+
* @returns True if the command was successful, otherwise false
|
|
608
|
+
* @example editor.commands.toggleHeaderCell()
|
|
609
|
+
*/
|
|
610
|
+
toggleHeaderCell: () => ReturnType;
|
|
611
|
+
/**
|
|
612
|
+
* Merge or split the currently selected cells
|
|
613
|
+
* @returns True if the command was successful, otherwise false
|
|
614
|
+
* @example editor.commands.mergeOrSplit()
|
|
615
|
+
*/
|
|
616
|
+
mergeOrSplit: () => ReturnType;
|
|
617
|
+
/**
|
|
618
|
+
* Set a cell attribute
|
|
619
|
+
* @param name The attribute name
|
|
620
|
+
* @param value The attribute value
|
|
621
|
+
* @returns True if the command was successful, otherwise false
|
|
622
|
+
* @example editor.commands.setCellAttribute('align', 'right')
|
|
623
|
+
*/
|
|
624
|
+
setCellAttribute: (name: string, value: any) => ReturnType;
|
|
625
|
+
/**
|
|
626
|
+
* Moves the selection to the next cell
|
|
627
|
+
* @returns True if the command was successful, otherwise false
|
|
628
|
+
* @example editor.commands.goToNextCell()
|
|
629
|
+
*/
|
|
630
|
+
goToNextCell: () => ReturnType;
|
|
631
|
+
/**
|
|
632
|
+
* Moves the selection to the previous cell
|
|
633
|
+
* @returns True if the command was successful, otherwise false
|
|
634
|
+
* @example editor.commands.goToPreviousCell()
|
|
635
|
+
*/
|
|
636
|
+
goToPreviousCell: () => ReturnType;
|
|
637
|
+
/**
|
|
638
|
+
* Try to fix the table structure if necessary
|
|
639
|
+
* @returns True if the command was successful, otherwise false
|
|
640
|
+
* @example editor.commands.fixTables()
|
|
641
|
+
*/
|
|
642
|
+
fixTables: () => ReturnType;
|
|
643
|
+
/**
|
|
644
|
+
* Set a cell selection inside the current table
|
|
645
|
+
* @param position The cell position
|
|
646
|
+
* @returns True if the command was successful, otherwise false
|
|
647
|
+
* @example editor.commands.setCellSelection({ anchorCell: 1, headCell: 2 })
|
|
648
|
+
*/
|
|
649
|
+
setCellSelection: (position: {
|
|
650
|
+
anchorCell: number;
|
|
651
|
+
headCell?: number;
|
|
652
|
+
}) => ReturnType;
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* This extension allows you to create tables.
|
|
658
|
+
* @see https://www.tiptap.dev/api/nodes/table
|
|
659
|
+
*/
|
|
660
|
+
declare const Table: Node<TableOptions, any>;
|
|
661
|
+
|
|
662
|
+
interface ImageOptions {
|
|
663
|
+
/**
|
|
664
|
+
* Controls if the image node should be inline or not.
|
|
665
|
+
* @default false
|
|
666
|
+
* @example true
|
|
667
|
+
*/
|
|
668
|
+
inline: boolean;
|
|
669
|
+
/**
|
|
670
|
+
* Controls if base64 images are allowed. Enable this if you want to allow
|
|
671
|
+
* base64 image urls in the `src` attribute.
|
|
672
|
+
* @default false
|
|
673
|
+
* @example true
|
|
674
|
+
*/
|
|
675
|
+
allowBase64: boolean;
|
|
676
|
+
/**
|
|
677
|
+
* HTML attributes to add to the image element.
|
|
678
|
+
* @default {}
|
|
679
|
+
* @example { class: 'foo' }
|
|
680
|
+
*/
|
|
681
|
+
HTMLAttributes: Record<string, any>;
|
|
682
|
+
/**
|
|
683
|
+
* Controls if the image should be resizable and how the resize is configured.
|
|
684
|
+
* @default false
|
|
685
|
+
* @example { directions: { top: true, right: true, bottom: true, left: true, topLeft: true, topRight: true, bottomLeft: true, bottomRight: true }, minWidth: 100, minHeight: 100 }
|
|
686
|
+
*/
|
|
687
|
+
resize: {
|
|
688
|
+
enabled: boolean;
|
|
689
|
+
directions?: ResizableNodeViewDirection[];
|
|
690
|
+
minWidth?: number;
|
|
691
|
+
minHeight?: number;
|
|
692
|
+
alwaysPreserveAspectRatio?: boolean;
|
|
693
|
+
} | false;
|
|
694
|
+
}
|
|
695
|
+
interface SetImageOptions {
|
|
696
|
+
src: string;
|
|
697
|
+
alt?: string;
|
|
698
|
+
title?: string;
|
|
699
|
+
width?: number;
|
|
700
|
+
height?: number;
|
|
701
|
+
}
|
|
702
|
+
declare module '@tiptap/core' {
|
|
703
|
+
interface Commands<ReturnType> {
|
|
704
|
+
image: {
|
|
705
|
+
/**
|
|
706
|
+
* Add an image
|
|
707
|
+
* @param options The image attributes
|
|
708
|
+
* @example
|
|
709
|
+
* editor
|
|
710
|
+
* .commands
|
|
711
|
+
* .setImage({ src: 'https://tiptap.dev/logo.png', alt: 'tiptap', title: 'tiptap logo' })
|
|
712
|
+
*/
|
|
713
|
+
setImage: (options: SetImageOptions) => ReturnType;
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* This extension allows you to insert images.
|
|
719
|
+
* @see https://www.tiptap.dev/api/nodes/image
|
|
720
|
+
*/
|
|
721
|
+
declare const Image: Node<ImageOptions, any>;
|
|
722
|
+
|
|
723
|
+
interface HardBreakOptions {
|
|
724
|
+
/**
|
|
725
|
+
* Controls if marks should be kept after being split by a hard break.
|
|
726
|
+
* @default true
|
|
727
|
+
* @example false
|
|
728
|
+
*/
|
|
729
|
+
keepMarks: boolean;
|
|
730
|
+
/**
|
|
731
|
+
* HTML attributes to add to the hard break element.
|
|
732
|
+
* @default {}
|
|
733
|
+
* @example { class: 'foo' }
|
|
734
|
+
*/
|
|
735
|
+
HTMLAttributes: Record<string, any>;
|
|
736
|
+
}
|
|
737
|
+
declare module '@tiptap/core' {
|
|
738
|
+
interface Commands<ReturnType> {
|
|
739
|
+
hardBreak: {
|
|
740
|
+
/**
|
|
741
|
+
* Add a hard break
|
|
742
|
+
* @example editor.commands.setHardBreak()
|
|
743
|
+
*/
|
|
744
|
+
setHardBreak: () => ReturnType;
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* This extension allows you to insert hard breaks.
|
|
750
|
+
* @see https://www.tiptap.dev/api/nodes/hard-break
|
|
751
|
+
*/
|
|
752
|
+
declare const HardBreak: Node<HardBreakOptions, any>;
|
|
753
|
+
|
|
754
|
+
interface DetailsOptions {
|
|
755
|
+
/**
|
|
756
|
+
* Specify if the open status should be saved in the document. Defaults to `false`.
|
|
757
|
+
*/
|
|
758
|
+
persist: boolean;
|
|
759
|
+
/**
|
|
760
|
+
* Specifies a CSS class that is set when toggling the content. Defaults to `is-open`.
|
|
761
|
+
*/
|
|
762
|
+
openClassName: string;
|
|
763
|
+
/**
|
|
764
|
+
* Custom HTML attributes that should be added to the rendered HTML tag.
|
|
765
|
+
*/
|
|
766
|
+
HTMLAttributes: {
|
|
767
|
+
[key: string]: any;
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
declare module '@tiptap/core' {
|
|
771
|
+
interface Commands<ReturnType> {
|
|
772
|
+
details: {
|
|
773
|
+
/**
|
|
774
|
+
* Set a details node
|
|
775
|
+
*/
|
|
776
|
+
setDetails: () => ReturnType;
|
|
777
|
+
/**
|
|
778
|
+
* Unset a details node
|
|
779
|
+
*/
|
|
780
|
+
unsetDetails: () => ReturnType;
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
declare const Details: Node<DetailsOptions, any>;
|
|
785
|
+
|
|
786
|
+
interface DetailsContentOptions {
|
|
787
|
+
/**
|
|
788
|
+
* Custom HTML attributes that should be added to the rendered HTML tag.
|
|
789
|
+
*/
|
|
790
|
+
HTMLAttributes: {
|
|
791
|
+
[key: string]: any;
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
declare const DetailsContent: Node<DetailsContentOptions, any>;
|
|
795
|
+
|
|
796
|
+
interface DetailsSummaryOptions {
|
|
797
|
+
/**
|
|
798
|
+
* Custom HTML attributes that should be added to the rendered HTML tag.
|
|
799
|
+
*/
|
|
800
|
+
HTMLAttributes: {
|
|
801
|
+
[key: string]: any;
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
declare const DetailsSummary: Node<DetailsSummaryOptions, any>;
|
|
805
|
+
|
|
806
|
+
interface Trigger {
|
|
807
|
+
char: string;
|
|
808
|
+
allowSpaces: boolean;
|
|
809
|
+
allowToIncludeChar: boolean;
|
|
810
|
+
allowedPrefixes: string[] | null;
|
|
811
|
+
startOfLine: boolean;
|
|
812
|
+
$position: ResolvedPos;
|
|
813
|
+
}
|
|
814
|
+
type SuggestionMatch = {
|
|
815
|
+
range: Range;
|
|
816
|
+
query: string;
|
|
817
|
+
text: string;
|
|
818
|
+
} | null;
|
|
819
|
+
declare function findSuggestionMatch(config: Trigger): SuggestionMatch;
|
|
820
|
+
|
|
821
|
+
interface SuggestionOptions<I = any, TSelected = any> {
|
|
822
|
+
/**
|
|
823
|
+
* The plugin key for the suggestion plugin.
|
|
824
|
+
* @default 'suggestion'
|
|
825
|
+
* @example 'mention'
|
|
826
|
+
*/
|
|
827
|
+
pluginKey?: PluginKey;
|
|
828
|
+
/**
|
|
829
|
+
* The editor instance.
|
|
830
|
+
* @default null
|
|
831
|
+
*/
|
|
832
|
+
editor: Editor;
|
|
833
|
+
/**
|
|
834
|
+
* The character that triggers the suggestion.
|
|
835
|
+
* @default '@'
|
|
836
|
+
* @example '#'
|
|
837
|
+
*/
|
|
838
|
+
char?: string;
|
|
839
|
+
/**
|
|
840
|
+
* Allow spaces in the suggestion query. Not compatible with `allowToIncludeChar`. Will be disabled if `allowToIncludeChar` is set to `true`.
|
|
841
|
+
* @default false
|
|
842
|
+
* @example true
|
|
843
|
+
*/
|
|
844
|
+
allowSpaces?: boolean;
|
|
845
|
+
/**
|
|
846
|
+
* Allow the character to be included in the suggestion query. Not compatible with `allowSpaces`.
|
|
847
|
+
* @default false
|
|
848
|
+
*/
|
|
849
|
+
allowToIncludeChar?: boolean;
|
|
850
|
+
/**
|
|
851
|
+
* Allow prefixes in the suggestion query.
|
|
852
|
+
* @default [' ']
|
|
853
|
+
* @example [' ', '@']
|
|
854
|
+
*/
|
|
855
|
+
allowedPrefixes?: string[] | null;
|
|
856
|
+
/**
|
|
857
|
+
* Only match suggestions at the start of the line.
|
|
858
|
+
* @default false
|
|
859
|
+
* @example true
|
|
860
|
+
*/
|
|
861
|
+
startOfLine?: boolean;
|
|
862
|
+
/**
|
|
863
|
+
* The tag name of the decoration node.
|
|
864
|
+
* @default 'span'
|
|
865
|
+
* @example 'div'
|
|
866
|
+
*/
|
|
867
|
+
decorationTag?: string;
|
|
868
|
+
/**
|
|
869
|
+
* The class name of the decoration node.
|
|
870
|
+
* @default 'suggestion'
|
|
871
|
+
* @example 'mention'
|
|
872
|
+
*/
|
|
873
|
+
decorationClass?: string;
|
|
874
|
+
/**
|
|
875
|
+
* Creates a decoration with the provided content.
|
|
876
|
+
* @param decorationContent - The content to display in the decoration
|
|
877
|
+
* @default "" - Creates an empty decoration if no content provided
|
|
878
|
+
*/
|
|
879
|
+
decorationContent?: string;
|
|
880
|
+
/**
|
|
881
|
+
* The class name of the decoration node when it is empty.
|
|
882
|
+
* @default 'is-empty'
|
|
883
|
+
* @example 'is-empty'
|
|
884
|
+
*/
|
|
885
|
+
decorationEmptyClass?: string;
|
|
886
|
+
/**
|
|
887
|
+
* A function that is called when a suggestion is selected.
|
|
888
|
+
* @param props The props object.
|
|
889
|
+
* @param props.editor The editor instance.
|
|
890
|
+
* @param props.range The range of the suggestion.
|
|
891
|
+
* @param props.props The props of the selected suggestion.
|
|
892
|
+
* @returns void
|
|
893
|
+
* @example ({ editor, range, props }) => { props.command(props.props) }
|
|
894
|
+
*/
|
|
895
|
+
command?: (props: {
|
|
896
|
+
editor: Editor;
|
|
897
|
+
range: Range;
|
|
898
|
+
props: TSelected;
|
|
899
|
+
}) => void;
|
|
900
|
+
/**
|
|
901
|
+
* A function that returns the suggestion items in form of an array.
|
|
902
|
+
* @param props The props object.
|
|
903
|
+
* @param props.editor The editor instance.
|
|
904
|
+
* @param props.query The current suggestion query.
|
|
905
|
+
* @returns An array of suggestion items.
|
|
906
|
+
* @example ({ editor, query }) => [{ id: 1, label: 'John Doe' }]
|
|
907
|
+
*/
|
|
908
|
+
items?: (props: {
|
|
909
|
+
query: string;
|
|
910
|
+
editor: Editor;
|
|
911
|
+
}) => I[] | Promise<I[]>;
|
|
912
|
+
/**
|
|
913
|
+
* The render function for the suggestion.
|
|
914
|
+
* @returns An object with render functions.
|
|
915
|
+
*/
|
|
916
|
+
render?: () => {
|
|
917
|
+
onBeforeStart?: (props: SuggestionProps<I, TSelected>) => void;
|
|
918
|
+
onStart?: (props: SuggestionProps<I, TSelected>) => void;
|
|
919
|
+
onBeforeUpdate?: (props: SuggestionProps<I, TSelected>) => void;
|
|
920
|
+
onUpdate?: (props: SuggestionProps<I, TSelected>) => void;
|
|
921
|
+
onExit?: (props: SuggestionProps<I, TSelected>) => void;
|
|
922
|
+
onKeyDown?: (props: SuggestionKeyDownProps) => boolean;
|
|
923
|
+
};
|
|
924
|
+
/**
|
|
925
|
+
* A function that returns a boolean to indicate if the suggestion should be active.
|
|
926
|
+
* @param props The props object.
|
|
927
|
+
* @returns {boolean}
|
|
928
|
+
*/
|
|
929
|
+
allow?: (props: {
|
|
930
|
+
editor: Editor;
|
|
931
|
+
state: EditorState;
|
|
932
|
+
range: Range;
|
|
933
|
+
isActive?: boolean;
|
|
934
|
+
}) => boolean;
|
|
935
|
+
findSuggestionMatch?: typeof findSuggestionMatch;
|
|
936
|
+
}
|
|
937
|
+
interface SuggestionProps<I = any, TSelected = any> {
|
|
938
|
+
/**
|
|
939
|
+
* The editor instance.
|
|
940
|
+
*/
|
|
941
|
+
editor: Editor;
|
|
942
|
+
/**
|
|
943
|
+
* The range of the suggestion.
|
|
944
|
+
*/
|
|
945
|
+
range: Range;
|
|
946
|
+
/**
|
|
947
|
+
* The current suggestion query.
|
|
948
|
+
*/
|
|
949
|
+
query: string;
|
|
950
|
+
/**
|
|
951
|
+
* The current suggestion text.
|
|
952
|
+
*/
|
|
953
|
+
text: string;
|
|
954
|
+
/**
|
|
955
|
+
* The suggestion items array.
|
|
956
|
+
*/
|
|
957
|
+
items: I[];
|
|
958
|
+
/**
|
|
959
|
+
* A function that is called when a suggestion is selected.
|
|
960
|
+
* @param props The props object.
|
|
961
|
+
* @returns void
|
|
962
|
+
*/
|
|
963
|
+
command: (props: TSelected) => void;
|
|
964
|
+
/**
|
|
965
|
+
* The decoration node HTML element
|
|
966
|
+
* @default null
|
|
967
|
+
*/
|
|
968
|
+
decorationNode: Element | null;
|
|
969
|
+
/**
|
|
970
|
+
* The function that returns the client rect
|
|
971
|
+
* @default null
|
|
972
|
+
* @example () => new DOMRect(0, 0, 0, 0)
|
|
973
|
+
*/
|
|
974
|
+
clientRect?: (() => DOMRect | null) | null;
|
|
975
|
+
}
|
|
976
|
+
interface SuggestionKeyDownProps {
|
|
977
|
+
view: EditorView;
|
|
978
|
+
event: KeyboardEvent;
|
|
979
|
+
range: Range;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
declare module '@tiptap/core' {
|
|
983
|
+
interface Commands<ReturnType> {
|
|
984
|
+
emoji: {
|
|
985
|
+
/**
|
|
986
|
+
* Add an emoji
|
|
987
|
+
*/
|
|
988
|
+
setEmoji: (shortcode: string) => ReturnType;
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
interface Storage {
|
|
992
|
+
emoji: EmojiStorage;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
type EmojiItem = {
|
|
996
|
+
/**
|
|
997
|
+
* A unique name of the emoji which will be stored as attribute
|
|
998
|
+
*/
|
|
999
|
+
name: string;
|
|
1000
|
+
/**
|
|
1001
|
+
* The emoji unicode character
|
|
1002
|
+
*/
|
|
1003
|
+
emoji?: string;
|
|
1004
|
+
/**
|
|
1005
|
+
* A list of unique shortcodes that are used by input rules to find the emoji
|
|
1006
|
+
*/
|
|
1007
|
+
shortcodes: string[];
|
|
1008
|
+
/**
|
|
1009
|
+
* A list of tags that can help for searching emojis
|
|
1010
|
+
*/
|
|
1011
|
+
tags: string[];
|
|
1012
|
+
/**
|
|
1013
|
+
* A name that can help to group emojis
|
|
1014
|
+
*/
|
|
1015
|
+
group?: string;
|
|
1016
|
+
/**
|
|
1017
|
+
* A list of unique emoticons
|
|
1018
|
+
*/
|
|
1019
|
+
emoticons?: string[];
|
|
1020
|
+
/**
|
|
1021
|
+
* The unicode version the emoji was introduced
|
|
1022
|
+
*/
|
|
1023
|
+
version?: number;
|
|
1024
|
+
/**
|
|
1025
|
+
* A fallback image if the current system doesn't support the emoji or for custom emojis
|
|
1026
|
+
*/
|
|
1027
|
+
fallbackImage?: string;
|
|
1028
|
+
/**
|
|
1029
|
+
* Store some custom data
|
|
1030
|
+
*/
|
|
1031
|
+
[key: string]: any;
|
|
1032
|
+
};
|
|
1033
|
+
type EmojiOptions = {
|
|
1034
|
+
HTMLAttributes: Record<string, any>;
|
|
1035
|
+
emojis: EmojiItem[];
|
|
1036
|
+
enableEmoticons: boolean;
|
|
1037
|
+
forceFallbackImages: boolean;
|
|
1038
|
+
suggestion: Omit<SuggestionOptions, 'editor'>;
|
|
1039
|
+
};
|
|
1040
|
+
type EmojiStorage = {
|
|
1041
|
+
emojis: EmojiItem[];
|
|
1042
|
+
isSupported: (item: EmojiItem) => boolean;
|
|
1043
|
+
};
|
|
1044
|
+
declare const Emoji: Node<EmojiOptions, EmojiStorage>;
|
|
1045
|
+
|
|
1046
|
+
interface MentionNodeAttrs {
|
|
1047
|
+
/**
|
|
1048
|
+
* The identifier for the selected item that was mentioned, stored as a `data-id`
|
|
1049
|
+
* attribute.
|
|
1050
|
+
*/
|
|
1051
|
+
id: string | null;
|
|
1052
|
+
/**
|
|
1053
|
+
* The label to be rendered by the editor as the displayed text for this mentioned
|
|
1054
|
+
* item, if provided. Stored as a `data-label` attribute. See `renderLabel`.
|
|
1055
|
+
*/
|
|
1056
|
+
label?: string | null;
|
|
1057
|
+
/**
|
|
1058
|
+
* The character that triggers the suggestion, stored as
|
|
1059
|
+
* `data-mention-suggestion-char` attribute.
|
|
1060
|
+
*/
|
|
1061
|
+
mentionSuggestionChar?: string;
|
|
1062
|
+
}
|
|
1063
|
+
interface MentionOptions<SuggestionItem = any, Attrs extends Record<string, any> = MentionNodeAttrs> {
|
|
1064
|
+
/**
|
|
1065
|
+
* The HTML attributes for a mention node.
|
|
1066
|
+
* @default {}
|
|
1067
|
+
* @example { class: 'foo' }
|
|
1068
|
+
*/
|
|
1069
|
+
HTMLAttributes: Record<string, any>;
|
|
1070
|
+
/**
|
|
1071
|
+
* A function to render the label of a mention.
|
|
1072
|
+
* @deprecated use renderText and renderHTML instead
|
|
1073
|
+
* @param props The render props
|
|
1074
|
+
* @returns The label
|
|
1075
|
+
* @example ({ options, node }) => `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`
|
|
1076
|
+
*/
|
|
1077
|
+
renderLabel?: (props: {
|
|
1078
|
+
options: MentionOptions<SuggestionItem, Attrs>;
|
|
1079
|
+
node: Node$1;
|
|
1080
|
+
suggestion: SuggestionOptions | null;
|
|
1081
|
+
}) => string;
|
|
1082
|
+
/**
|
|
1083
|
+
* A function to render the text of a mention.
|
|
1084
|
+
* @param props The render props
|
|
1085
|
+
* @returns The text
|
|
1086
|
+
* @example ({ options, node }) => `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`
|
|
1087
|
+
*/
|
|
1088
|
+
renderText: (props: {
|
|
1089
|
+
options: MentionOptions<SuggestionItem, Attrs>;
|
|
1090
|
+
node: Node$1;
|
|
1091
|
+
suggestion: SuggestionOptions | null;
|
|
1092
|
+
}) => string;
|
|
1093
|
+
/**
|
|
1094
|
+
* A function to render the HTML of a mention.
|
|
1095
|
+
* @param props The render props
|
|
1096
|
+
* @returns The HTML as a ProseMirror DOM Output Spec
|
|
1097
|
+
* @example ({ options, node }) => ['span', { 'data-type': 'mention' }, `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`]
|
|
1098
|
+
*/
|
|
1099
|
+
renderHTML: (props: {
|
|
1100
|
+
options: MentionOptions<SuggestionItem, Attrs>;
|
|
1101
|
+
node: Node$1;
|
|
1102
|
+
suggestion: SuggestionOptions | null;
|
|
1103
|
+
}) => DOMOutputSpec;
|
|
1104
|
+
/**
|
|
1105
|
+
* Whether to delete the trigger character with backspace.
|
|
1106
|
+
* @default false
|
|
1107
|
+
*/
|
|
1108
|
+
deleteTriggerWithBackspace: boolean;
|
|
1109
|
+
/**
|
|
1110
|
+
* The suggestion options, when you want to support multiple triggers.
|
|
1111
|
+
*
|
|
1112
|
+
* With this parameter, you can define multiple types of mention. For example, you can use the `@` character
|
|
1113
|
+
* to mention users and the `#` character to mention tags.
|
|
1114
|
+
*
|
|
1115
|
+
* @default [{ char: '@', pluginKey: MentionPluginKey }]
|
|
1116
|
+
* @example [{ char: '@', pluginKey: MentionPluginKey }, { char: '#', pluginKey: new PluginKey('hashtag') }]
|
|
1117
|
+
*/
|
|
1118
|
+
suggestions: Array<Omit<SuggestionOptions<SuggestionItem, Attrs>, 'editor'>>;
|
|
1119
|
+
/**
|
|
1120
|
+
* The suggestion options, when you want to support only one trigger. To support multiple triggers, use the
|
|
1121
|
+
* `suggestions` parameter instead.
|
|
1122
|
+
*
|
|
1123
|
+
* @default {}
|
|
1124
|
+
* @example { char: '@', pluginKey: MentionPluginKey, command: ({ editor, range, props }) => { ... } }
|
|
1125
|
+
*/
|
|
1126
|
+
suggestion: Omit<SuggestionOptions<SuggestionItem, Attrs>, 'editor'>;
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* This extension allows you to insert mentions into the editor.
|
|
1130
|
+
* @see https://www.tiptap.dev/api/extensions/mention
|
|
1131
|
+
*/
|
|
1132
|
+
declare const Mention: Node<MentionOptions<any, MentionNodeAttrs>, any>;
|
|
1133
|
+
|
|
1134
|
+
/** @jsxImportSource @tiptap/core */
|
|
1135
|
+
|
|
1136
|
+
interface BoldOptions {
|
|
1137
|
+
/**
|
|
1138
|
+
* HTML attributes to add to the bold element.
|
|
1139
|
+
* @default {}
|
|
1140
|
+
* @example { class: 'foo' }
|
|
1141
|
+
*/
|
|
1142
|
+
HTMLAttributes: Record<string, any>;
|
|
1143
|
+
}
|
|
1144
|
+
declare module '@tiptap/core' {
|
|
1145
|
+
interface Commands<ReturnType> {
|
|
1146
|
+
bold: {
|
|
1147
|
+
/**
|
|
1148
|
+
* Set a bold mark
|
|
1149
|
+
*/
|
|
1150
|
+
setBold: () => ReturnType;
|
|
1151
|
+
/**
|
|
1152
|
+
* Toggle a bold mark
|
|
1153
|
+
*/
|
|
1154
|
+
toggleBold: () => ReturnType;
|
|
1155
|
+
/**
|
|
1156
|
+
* Unset a bold mark
|
|
1157
|
+
*/
|
|
1158
|
+
unsetBold: () => ReturnType;
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* This extension allows you to mark text as bold.
|
|
1164
|
+
* @see https://tiptap.dev/api/marks/bold
|
|
1165
|
+
*/
|
|
1166
|
+
declare const Bold: Mark<BoldOptions, any>;
|
|
1167
|
+
|
|
1168
|
+
interface ItalicOptions {
|
|
1169
|
+
/**
|
|
1170
|
+
* HTML attributes to add to the italic element.
|
|
1171
|
+
* @default {}
|
|
1172
|
+
* @example { class: 'foo' }
|
|
1173
|
+
*/
|
|
1174
|
+
HTMLAttributes: Record<string, any>;
|
|
1175
|
+
}
|
|
1176
|
+
declare module '@tiptap/core' {
|
|
1177
|
+
interface Commands<ReturnType> {
|
|
1178
|
+
italic: {
|
|
1179
|
+
/**
|
|
1180
|
+
* Set an italic mark
|
|
1181
|
+
* @example editor.commands.setItalic()
|
|
1182
|
+
*/
|
|
1183
|
+
setItalic: () => ReturnType;
|
|
1184
|
+
/**
|
|
1185
|
+
* Toggle an italic mark
|
|
1186
|
+
* @example editor.commands.toggleItalic()
|
|
1187
|
+
*/
|
|
1188
|
+
toggleItalic: () => ReturnType;
|
|
1189
|
+
/**
|
|
1190
|
+
* Unset an italic mark
|
|
1191
|
+
* @example editor.commands.unsetItalic()
|
|
1192
|
+
*/
|
|
1193
|
+
unsetItalic: () => ReturnType;
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1198
|
+
* This extension allows you to create italic text.
|
|
1199
|
+
* @see https://www.tiptap.dev/api/marks/italic
|
|
1200
|
+
*/
|
|
1201
|
+
declare const Italic: Mark<ItalicOptions, any>;
|
|
1202
|
+
|
|
1203
|
+
interface UnderlineOptions {
|
|
1204
|
+
/**
|
|
1205
|
+
* HTML attributes to add to the underline element.
|
|
1206
|
+
* @default {}
|
|
1207
|
+
* @example { class: 'foo' }
|
|
1208
|
+
*/
|
|
1209
|
+
HTMLAttributes: Record<string, any>;
|
|
1210
|
+
}
|
|
1211
|
+
declare module '@tiptap/core' {
|
|
1212
|
+
interface Commands<ReturnType> {
|
|
1213
|
+
underline: {
|
|
1214
|
+
/**
|
|
1215
|
+
* Set an underline mark
|
|
1216
|
+
* @example editor.commands.setUnderline()
|
|
1217
|
+
*/
|
|
1218
|
+
setUnderline: () => ReturnType;
|
|
1219
|
+
/**
|
|
1220
|
+
* Toggle an underline mark
|
|
1221
|
+
* @example editor.commands.toggleUnderline()
|
|
1222
|
+
*/
|
|
1223
|
+
toggleUnderline: () => ReturnType;
|
|
1224
|
+
/**
|
|
1225
|
+
* Unset an underline mark
|
|
1226
|
+
* @example editor.commands.unsetUnderline()
|
|
1227
|
+
*/
|
|
1228
|
+
unsetUnderline: () => ReturnType;
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* This extension allows you to create underline text.
|
|
1234
|
+
* @see https://www.tiptap.dev/api/marks/underline
|
|
1235
|
+
*/
|
|
1236
|
+
declare const Underline: Mark<UnderlineOptions, any>;
|
|
1237
|
+
|
|
1238
|
+
interface StrikeOptions {
|
|
1239
|
+
/**
|
|
1240
|
+
* HTML attributes to add to the strike element.
|
|
1241
|
+
* @default {}
|
|
1242
|
+
* @example { class: 'foo' }
|
|
1243
|
+
*/
|
|
1244
|
+
HTMLAttributes: Record<string, any>;
|
|
1245
|
+
}
|
|
1246
|
+
declare module '@tiptap/core' {
|
|
1247
|
+
interface Commands<ReturnType> {
|
|
1248
|
+
strike: {
|
|
1249
|
+
/**
|
|
1250
|
+
* Set a strike mark
|
|
1251
|
+
* @example editor.commands.setStrike()
|
|
1252
|
+
*/
|
|
1253
|
+
setStrike: () => ReturnType;
|
|
1254
|
+
/**
|
|
1255
|
+
* Toggle a strike mark
|
|
1256
|
+
* @example editor.commands.toggleStrike()
|
|
1257
|
+
*/
|
|
1258
|
+
toggleStrike: () => ReturnType;
|
|
1259
|
+
/**
|
|
1260
|
+
* Unset a strike mark
|
|
1261
|
+
* @example editor.commands.unsetStrike()
|
|
1262
|
+
*/
|
|
1263
|
+
unsetStrike: () => ReturnType;
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* This extension allows you to create strike text.
|
|
1269
|
+
* @see https://www.tiptap.dev/api/marks/strike
|
|
1270
|
+
*/
|
|
1271
|
+
declare const Strike: Mark<StrikeOptions, any>;
|
|
1272
|
+
|
|
1273
|
+
interface CodeOptions {
|
|
1274
|
+
/**
|
|
1275
|
+
* The HTML attributes applied to the code element.
|
|
1276
|
+
* @default {}
|
|
1277
|
+
* @example { class: 'foo' }
|
|
1278
|
+
*/
|
|
1279
|
+
HTMLAttributes: Record<string, any>;
|
|
1280
|
+
}
|
|
1281
|
+
declare module '@tiptap/core' {
|
|
1282
|
+
interface Commands<ReturnType> {
|
|
1283
|
+
code: {
|
|
1284
|
+
/**
|
|
1285
|
+
* Set a code mark
|
|
1286
|
+
*/
|
|
1287
|
+
setCode: () => ReturnType;
|
|
1288
|
+
/**
|
|
1289
|
+
* Toggle inline code
|
|
1290
|
+
*/
|
|
1291
|
+
toggleCode: () => ReturnType;
|
|
1292
|
+
/**
|
|
1293
|
+
* Unset a code mark
|
|
1294
|
+
*/
|
|
1295
|
+
unsetCode: () => ReturnType;
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* This extension allows you to mark text as inline code.
|
|
1301
|
+
* @see https://tiptap.dev/api/marks/code
|
|
1302
|
+
*/
|
|
1303
|
+
declare const Code: Mark<CodeOptions, any>;
|
|
1304
|
+
|
|
1305
|
+
interface LinkProtocolOptions {
|
|
1306
|
+
/**
|
|
1307
|
+
* The protocol scheme to be registered.
|
|
1308
|
+
* @default '''
|
|
1309
|
+
* @example 'ftp'
|
|
1310
|
+
* @example 'git'
|
|
1311
|
+
*/
|
|
1312
|
+
scheme: string;
|
|
1313
|
+
/**
|
|
1314
|
+
* If enabled, it allows optional slashes after the protocol.
|
|
1315
|
+
* @default false
|
|
1316
|
+
* @example true
|
|
1317
|
+
*/
|
|
1318
|
+
optionalSlashes?: boolean;
|
|
1319
|
+
}
|
|
1320
|
+
/**
|
|
1321
|
+
* @deprecated The default behavior is now to open links when the editor is not editable.
|
|
1322
|
+
*/
|
|
1323
|
+
type DeprecatedOpenWhenNotEditable = 'whenNotEditable';
|
|
1324
|
+
interface LinkOptions {
|
|
1325
|
+
/**
|
|
1326
|
+
* If enabled, the extension will automatically add links as you type.
|
|
1327
|
+
* @default true
|
|
1328
|
+
* @example false
|
|
1329
|
+
*/
|
|
1330
|
+
autolink: boolean;
|
|
1331
|
+
/**
|
|
1332
|
+
* An array of custom protocols to be registered with linkifyjs.
|
|
1333
|
+
* @default []
|
|
1334
|
+
* @example ['ftp', 'git']
|
|
1335
|
+
*/
|
|
1336
|
+
protocols: Array<LinkProtocolOptions | string>;
|
|
1337
|
+
/**
|
|
1338
|
+
* Default protocol to use when no protocol is specified.
|
|
1339
|
+
* @default 'http'
|
|
1340
|
+
*/
|
|
1341
|
+
defaultProtocol: string;
|
|
1342
|
+
/**
|
|
1343
|
+
* If enabled, links will be opened on click.
|
|
1344
|
+
* @default true
|
|
1345
|
+
* @example false
|
|
1346
|
+
*/
|
|
1347
|
+
openOnClick: boolean | DeprecatedOpenWhenNotEditable;
|
|
1348
|
+
/**
|
|
1349
|
+
* If enabled, the link will be selected when clicked.
|
|
1350
|
+
* @default false
|
|
1351
|
+
* @example true
|
|
1352
|
+
*/
|
|
1353
|
+
enableClickSelection: boolean;
|
|
1354
|
+
/**
|
|
1355
|
+
* Adds a link to the current selection if the pasted content only contains an url.
|
|
1356
|
+
* @default true
|
|
1357
|
+
* @example false
|
|
1358
|
+
*/
|
|
1359
|
+
linkOnPaste: boolean;
|
|
1360
|
+
/**
|
|
1361
|
+
* HTML attributes to add to the link element.
|
|
1362
|
+
* @default {}
|
|
1363
|
+
* @example { class: 'foo' }
|
|
1364
|
+
*/
|
|
1365
|
+
HTMLAttributes: Record<string, any>;
|
|
1366
|
+
/**
|
|
1367
|
+
* @deprecated Use the `shouldAutoLink` option instead.
|
|
1368
|
+
* A validation function that modifies link verification for the auto linker.
|
|
1369
|
+
* @param url - The url to be validated.
|
|
1370
|
+
* @returns - True if the url is valid, false otherwise.
|
|
1371
|
+
*/
|
|
1372
|
+
validate: (url: string) => boolean;
|
|
1373
|
+
/**
|
|
1374
|
+
* A validation function which is used for configuring link verification for preventing XSS attacks.
|
|
1375
|
+
* Only modify this if you know what you're doing.
|
|
1376
|
+
*
|
|
1377
|
+
* @returns {boolean} `true` if the URL is valid, `false` otherwise.
|
|
1378
|
+
*
|
|
1379
|
+
* @example
|
|
1380
|
+
* isAllowedUri: (url, { defaultValidate, protocols, defaultProtocol }) => {
|
|
1381
|
+
* return url.startsWith('./') || defaultValidate(url)
|
|
1382
|
+
* }
|
|
1383
|
+
*/
|
|
1384
|
+
isAllowedUri: (
|
|
1385
|
+
/**
|
|
1386
|
+
* The URL to be validated.
|
|
1387
|
+
*/
|
|
1388
|
+
url: string, ctx: {
|
|
1389
|
+
/**
|
|
1390
|
+
* The default validation function.
|
|
1391
|
+
*/
|
|
1392
|
+
defaultValidate: (url: string) => boolean;
|
|
1393
|
+
/**
|
|
1394
|
+
* An array of allowed protocols for the URL (e.g., "http", "https"). As defined in the `protocols` option.
|
|
1395
|
+
*/
|
|
1396
|
+
protocols: Array<LinkProtocolOptions | string>;
|
|
1397
|
+
/**
|
|
1398
|
+
* A string that represents the default protocol (e.g., 'http'). As defined in the `defaultProtocol` option.
|
|
1399
|
+
*/
|
|
1400
|
+
defaultProtocol: string;
|
|
1401
|
+
}) => boolean;
|
|
1402
|
+
/**
|
|
1403
|
+
* Determines whether a valid link should be automatically linked in the content.
|
|
1404
|
+
*
|
|
1405
|
+
* @param {string} url - The URL that has already been validated.
|
|
1406
|
+
* @returns {boolean} - True if the link should be auto-linked; false if it should not be auto-linked.
|
|
1407
|
+
*/
|
|
1408
|
+
shouldAutoLink: (url: string) => boolean;
|
|
1409
|
+
}
|
|
1410
|
+
declare module '@tiptap/core' {
|
|
1411
|
+
interface Commands<ReturnType> {
|
|
1412
|
+
link: {
|
|
1413
|
+
/**
|
|
1414
|
+
* Set a link mark
|
|
1415
|
+
* @param attributes The link attributes
|
|
1416
|
+
* @example editor.commands.setLink({ href: 'https://tiptap.dev' })
|
|
1417
|
+
*/
|
|
1418
|
+
setLink: (attributes: {
|
|
1419
|
+
href: string;
|
|
1420
|
+
target?: string | null;
|
|
1421
|
+
rel?: string | null;
|
|
1422
|
+
class?: string | null;
|
|
1423
|
+
}) => ReturnType;
|
|
1424
|
+
/**
|
|
1425
|
+
* Toggle a link mark
|
|
1426
|
+
* @param attributes The link attributes
|
|
1427
|
+
* @example editor.commands.toggleLink({ href: 'https://tiptap.dev' })
|
|
1428
|
+
*/
|
|
1429
|
+
toggleLink: (attributes?: {
|
|
1430
|
+
href: string;
|
|
1431
|
+
target?: string | null;
|
|
1432
|
+
rel?: string | null;
|
|
1433
|
+
class?: string | null;
|
|
1434
|
+
}) => ReturnType;
|
|
1435
|
+
/**
|
|
1436
|
+
* Unset a link mark
|
|
1437
|
+
* @example editor.commands.unsetLink()
|
|
1438
|
+
*/
|
|
1439
|
+
unsetLink: () => ReturnType;
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* This extension allows you to create links.
|
|
1445
|
+
* @see https://www.tiptap.dev/api/marks/link
|
|
1446
|
+
*/
|
|
1447
|
+
declare const Link: Mark<LinkOptions, any>;
|
|
1448
|
+
|
|
1449
|
+
interface HighlightOptions {
|
|
1450
|
+
/**
|
|
1451
|
+
* Allow multiple highlight colors
|
|
1452
|
+
* @default false
|
|
1453
|
+
* @example true
|
|
1454
|
+
*/
|
|
1455
|
+
multicolor: boolean;
|
|
1456
|
+
/**
|
|
1457
|
+
* HTML attributes to add to the highlight element.
|
|
1458
|
+
* @default {}
|
|
1459
|
+
* @example { class: 'foo' }
|
|
1460
|
+
*/
|
|
1461
|
+
HTMLAttributes: Record<string, any>;
|
|
1462
|
+
}
|
|
1463
|
+
declare module '@tiptap/core' {
|
|
1464
|
+
interface Commands<ReturnType> {
|
|
1465
|
+
highlight: {
|
|
1466
|
+
/**
|
|
1467
|
+
* Set a highlight mark
|
|
1468
|
+
* @param attributes The highlight attributes
|
|
1469
|
+
* @example editor.commands.setHighlight({ color: 'red' })
|
|
1470
|
+
*/
|
|
1471
|
+
setHighlight: (attributes?: {
|
|
1472
|
+
color: string;
|
|
1473
|
+
}) => ReturnType;
|
|
1474
|
+
/**
|
|
1475
|
+
* Toggle a highlight mark
|
|
1476
|
+
* @param attributes The highlight attributes
|
|
1477
|
+
* @example editor.commands.toggleHighlight({ color: 'red' })
|
|
1478
|
+
*/
|
|
1479
|
+
toggleHighlight: (attributes?: {
|
|
1480
|
+
color: string;
|
|
1481
|
+
}) => ReturnType;
|
|
1482
|
+
/**
|
|
1483
|
+
* Unset a highlight mark
|
|
1484
|
+
* @example editor.commands.unsetHighlight()
|
|
1485
|
+
*/
|
|
1486
|
+
unsetHighlight: () => ReturnType;
|
|
1487
|
+
};
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* This extension allows you to highlight text.
|
|
1492
|
+
* @see https://www.tiptap.dev/api/marks/highlight
|
|
1493
|
+
*/
|
|
1494
|
+
declare const Highlight: Mark<HighlightOptions, any>;
|
|
1495
|
+
|
|
1496
|
+
interface SubscriptExtensionOptions {
|
|
1497
|
+
/**
|
|
1498
|
+
* HTML attributes to add to the subscript element.
|
|
1499
|
+
* @default {}
|
|
1500
|
+
* @example { class: 'foo' }
|
|
1501
|
+
*/
|
|
1502
|
+
HTMLAttributes: Record<string, any>;
|
|
1503
|
+
}
|
|
1504
|
+
declare module '@tiptap/core' {
|
|
1505
|
+
interface Commands<ReturnType> {
|
|
1506
|
+
subscript: {
|
|
1507
|
+
/**
|
|
1508
|
+
* Set a subscript mark
|
|
1509
|
+
* @example editor.commands.setSubscript()
|
|
1510
|
+
*/
|
|
1511
|
+
setSubscript: () => ReturnType;
|
|
1512
|
+
/**
|
|
1513
|
+
* Toggle a subscript mark
|
|
1514
|
+
* @example editor.commands.toggleSubscript()
|
|
1515
|
+
*/
|
|
1516
|
+
toggleSubscript: () => ReturnType;
|
|
1517
|
+
/**
|
|
1518
|
+
* Unset a subscript mark
|
|
1519
|
+
* @example editor.commands.unsetSubscript()
|
|
1520
|
+
*/
|
|
1521
|
+
unsetSubscript: () => ReturnType;
|
|
1522
|
+
};
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* This extension allows you to create subscript text.
|
|
1527
|
+
* @see https://www.tiptap.dev/api/marks/subscript
|
|
1528
|
+
*/
|
|
1529
|
+
declare const Subscript: Mark<SubscriptExtensionOptions, any>;
|
|
1530
|
+
|
|
1531
|
+
interface SuperscriptExtensionOptions {
|
|
1532
|
+
/**
|
|
1533
|
+
* HTML attributes to add to the superscript element.
|
|
1534
|
+
* @default {}
|
|
1535
|
+
* @example { class: 'foo' }
|
|
1536
|
+
*/
|
|
1537
|
+
HTMLAttributes: Record<string, any>;
|
|
1538
|
+
}
|
|
1539
|
+
declare module '@tiptap/core' {
|
|
1540
|
+
interface Commands<ReturnType> {
|
|
1541
|
+
superscript: {
|
|
1542
|
+
/**
|
|
1543
|
+
* Set a superscript mark
|
|
1544
|
+
* @example editor.commands.setSuperscript()
|
|
1545
|
+
*/
|
|
1546
|
+
setSuperscript: () => ReturnType;
|
|
1547
|
+
/**
|
|
1548
|
+
* Toggle a superscript mark
|
|
1549
|
+
* @example editor.commands.toggleSuperscript()
|
|
1550
|
+
*/
|
|
1551
|
+
toggleSuperscript: () => ReturnType;
|
|
1552
|
+
/**
|
|
1553
|
+
* Unset a superscript mark
|
|
1554
|
+
* @example editor.commands.unsetSuperscript()
|
|
1555
|
+
*/
|
|
1556
|
+
unsetSuperscript: () => ReturnType;
|
|
1557
|
+
};
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* This extension allows you to create superscript text.
|
|
1562
|
+
* @see https://www.tiptap.dev/api/marks/superscript
|
|
1563
|
+
*/
|
|
1564
|
+
declare const Superscript: Mark<SuperscriptExtensionOptions, any>;
|
|
1565
|
+
|
|
1566
|
+
interface TextStyleOptions {
|
|
1567
|
+
/**
|
|
1568
|
+
* HTML attributes to add to the span element.
|
|
1569
|
+
* @default {}
|
|
1570
|
+
* @example { class: 'foo' }
|
|
1571
|
+
*/
|
|
1572
|
+
HTMLAttributes: Record<string, any>;
|
|
1573
|
+
/**
|
|
1574
|
+
* When enabled, merges the styles of nested spans into the child span during HTML parsing.
|
|
1575
|
+
* This prioritizes the style of the child span.
|
|
1576
|
+
* Used when parsing content created in other editors.
|
|
1577
|
+
* (Fix for ProseMirror's default behavior.)
|
|
1578
|
+
* @default true
|
|
1579
|
+
*/
|
|
1580
|
+
mergeNestedSpanStyles: boolean;
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* This extension allows you to create text styles. It is required by default
|
|
1584
|
+
* for the `text-color` and `font-family` extensions.
|
|
1585
|
+
* @see https://www.tiptap.dev/api/marks/text-style
|
|
1586
|
+
*/
|
|
1587
|
+
declare const TextStyle: Mark<TextStyleOptions, any>;
|
|
1588
|
+
|
|
1589
|
+
type BackgroundColorOptions = {
|
|
1590
|
+
/**
|
|
1591
|
+
* The types where the color can be applied
|
|
1592
|
+
* @default ['textStyle']
|
|
1593
|
+
* @example ['heading', 'paragraph']
|
|
1594
|
+
*/
|
|
1595
|
+
types: string[];
|
|
1596
|
+
};
|
|
1597
|
+
/**
|
|
1598
|
+
* This extension allows you to color your text.
|
|
1599
|
+
* @see https://tiptap.dev/api/extensions/background-color
|
|
1600
|
+
*/
|
|
1601
|
+
declare const BackgroundColor: Extension<BackgroundColorOptions, any>;
|
|
1602
|
+
|
|
1603
|
+
type ColorOptions = {
|
|
1604
|
+
/**
|
|
1605
|
+
* The types where the color can be applied
|
|
1606
|
+
* @default ['textStyle']
|
|
1607
|
+
* @example ['heading', 'paragraph']
|
|
1608
|
+
*/
|
|
1609
|
+
types: string[];
|
|
1610
|
+
};
|
|
1611
|
+
/**
|
|
1612
|
+
* This extension allows you to color your text.
|
|
1613
|
+
* @see https://tiptap.dev/api/extensions/color
|
|
1614
|
+
*/
|
|
1615
|
+
declare const Color: Extension<ColorOptions, any>;
|
|
1616
|
+
|
|
1617
|
+
type FontFamilyOptions = {
|
|
1618
|
+
/**
|
|
1619
|
+
* A list of node names where the font family can be applied.
|
|
1620
|
+
* @default ['textStyle']
|
|
1621
|
+
* @example ['heading', 'paragraph']
|
|
1622
|
+
*/
|
|
1623
|
+
types: string[];
|
|
1624
|
+
};
|
|
1625
|
+
/**
|
|
1626
|
+
* This extension allows you to set a font family for text.
|
|
1627
|
+
* @see https://www.tiptap.dev/api/extensions/font-family
|
|
1628
|
+
*/
|
|
1629
|
+
declare const FontFamily: Extension<FontFamilyOptions, any>;
|
|
1630
|
+
|
|
1631
|
+
type FontSizeOptions = {
|
|
1632
|
+
/**
|
|
1633
|
+
* A list of node names where the font size can be applied.
|
|
1634
|
+
* @default ['textStyle']
|
|
1635
|
+
* @example ['heading', 'paragraph']
|
|
1636
|
+
*/
|
|
1637
|
+
types: string[];
|
|
1638
|
+
};
|
|
1639
|
+
/**
|
|
1640
|
+
* This extension allows you to set a font size for text.
|
|
1641
|
+
* @see https://www.tiptap.dev/api/extensions/font-size
|
|
1642
|
+
*/
|
|
1643
|
+
declare const FontSize: Extension<FontSizeOptions, any>;
|
|
1644
|
+
|
|
1645
|
+
type LineHeightOptions = {
|
|
1646
|
+
/**
|
|
1647
|
+
* A list of node names where the line height can be applied.
|
|
1648
|
+
* @default ['textStyle']
|
|
1649
|
+
* @example ['heading', 'paragraph']
|
|
1650
|
+
*/
|
|
1651
|
+
types: string[];
|
|
1652
|
+
};
|
|
1653
|
+
declare module '@tiptap/core' {
|
|
1654
|
+
interface Commands<ReturnType> {
|
|
1655
|
+
textStyle: {
|
|
1656
|
+
/**
|
|
1657
|
+
* Remove spans without inline style attributes.
|
|
1658
|
+
* @example editor.commands.removeEmptyTextStyle()
|
|
1659
|
+
*/
|
|
1660
|
+
removeEmptyTextStyle: () => ReturnType;
|
|
1661
|
+
/**
|
|
1662
|
+
* Toggle a text style
|
|
1663
|
+
* @param attributes The text style attributes
|
|
1664
|
+
* @example editor.commands.toggleTextStyle({ fontWeight: 'bold' })
|
|
1665
|
+
*/
|
|
1666
|
+
toggleTextStyle: (attributes?: TextStyleAttributes) => ReturnType;
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
declare module '@tiptap/core' {
|
|
1671
|
+
interface Commands<ReturnType> {
|
|
1672
|
+
backgroundColor: {
|
|
1673
|
+
/**
|
|
1674
|
+
* Set the text color
|
|
1675
|
+
* @param backgroundColor The color to set
|
|
1676
|
+
* @example editor.commands.setColor('red')
|
|
1677
|
+
*/
|
|
1678
|
+
setBackgroundColor: (backgroundColor: string) => ReturnType;
|
|
1679
|
+
/**
|
|
1680
|
+
* Unset the text backgroundColor
|
|
1681
|
+
* @example editor.commands.unsetBackgroundColor()
|
|
1682
|
+
*/
|
|
1683
|
+
unsetBackgroundColor: () => ReturnType;
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
declare module '@tiptap/core' {
|
|
1688
|
+
interface Commands<ReturnType> {
|
|
1689
|
+
color: {
|
|
1690
|
+
/**
|
|
1691
|
+
* Set the text color
|
|
1692
|
+
* @param color The color to set
|
|
1693
|
+
* @example editor.commands.setColor('red')
|
|
1694
|
+
*/
|
|
1695
|
+
setColor: (color: string) => ReturnType;
|
|
1696
|
+
/**
|
|
1697
|
+
* Unset the text color
|
|
1698
|
+
* @example editor.commands.unsetColor()
|
|
1699
|
+
*/
|
|
1700
|
+
unsetColor: () => ReturnType;
|
|
1701
|
+
};
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
declare module '@tiptap/core' {
|
|
1705
|
+
interface Commands<ReturnType> {
|
|
1706
|
+
fontFamily: {
|
|
1707
|
+
/**
|
|
1708
|
+
* Set the font family
|
|
1709
|
+
* @param fontFamily The font family
|
|
1710
|
+
* @example editor.commands.setFontFamily('Arial')
|
|
1711
|
+
*/
|
|
1712
|
+
setFontFamily: (fontFamily: string) => ReturnType;
|
|
1713
|
+
/**
|
|
1714
|
+
* Unset the font family
|
|
1715
|
+
* @example editor.commands.unsetFontFamily()
|
|
1716
|
+
*/
|
|
1717
|
+
unsetFontFamily: () => ReturnType;
|
|
1718
|
+
};
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
declare module '@tiptap/core' {
|
|
1722
|
+
interface Commands<ReturnType> {
|
|
1723
|
+
fontSize: {
|
|
1724
|
+
/**
|
|
1725
|
+
* Set the font size
|
|
1726
|
+
* @param fontSize The font size
|
|
1727
|
+
* @example editor.commands.setFontSize('16px')
|
|
1728
|
+
*/
|
|
1729
|
+
setFontSize: (fontSize: string) => ReturnType;
|
|
1730
|
+
/**
|
|
1731
|
+
* Unset the font size
|
|
1732
|
+
* @example editor.commands.unsetFontSize()
|
|
1733
|
+
*/
|
|
1734
|
+
unsetFontSize: () => ReturnType;
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
declare module '@tiptap/core' {
|
|
1739
|
+
interface Commands<ReturnType> {
|
|
1740
|
+
lineHeight: {
|
|
1741
|
+
/**
|
|
1742
|
+
* Set the line height
|
|
1743
|
+
* @param lineHeight The line height
|
|
1744
|
+
* @example editor.commands.setLineHeight('1.5')
|
|
1745
|
+
*/
|
|
1746
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
1747
|
+
/**
|
|
1748
|
+
* Unset the line height
|
|
1749
|
+
* @example editor.commands.unsetLineHeight()
|
|
1750
|
+
*/
|
|
1751
|
+
unsetLineHeight: () => ReturnType;
|
|
1752
|
+
};
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
declare module '@tiptap/extension-text-style' {
|
|
1756
|
+
interface TextStyleAttributes {
|
|
1757
|
+
backgroundColor?: string | null;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
declare module '@tiptap/extension-text-style' {
|
|
1761
|
+
interface TextStyleAttributes {
|
|
1762
|
+
color?: string | null;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
declare module '@tiptap/extension-text-style' {
|
|
1766
|
+
interface TextStyleAttributes {
|
|
1767
|
+
fontFamily?: string | null;
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
declare module '@tiptap/extension-text-style' {
|
|
1771
|
+
interface TextStyleAttributes {
|
|
1772
|
+
fontSize?: string | null;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
declare module '@tiptap/extension-text-style' {
|
|
1776
|
+
interface TextStyleAttributes {
|
|
1777
|
+
lineHeight?: string | null;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* This extension allows you to set the line-height for text.
|
|
1782
|
+
* @see https://www.tiptap.dev/api/extensions/line-height
|
|
1783
|
+
*/
|
|
1784
|
+
declare const LineHeight: Extension<LineHeightOptions, any>;
|
|
1785
|
+
|
|
1786
|
+
/**
|
|
1787
|
+
* The available text style attributes.
|
|
1788
|
+
*/
|
|
1789
|
+
interface TextStyleAttributes extends Record<string, any> {
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
export { TableRow as A, Blockquote as B, CodeBlockLowlight as C, Document as D, Emoji as E, FontFamily as F, Image as G, ListItem as L, Mention as M, OrderedList as O, Strike as S, Underline as U, Text as a, HorizontalRule as b, BulletList as c, TaskList as d, TaskItem as e, Table as f, TableCell as g, TableHeader as h, HardBreak as i, Details as j, DetailsSummary as k, DetailsContent as l, Bold as m, Italic as n, Code as o, Link as p, Highlight as q, Subscript as r, Superscript as s, TextStyle as t, Color as u, BackgroundColor as v, FontSize as w, LineHeight as x, Paragraph as y, Heading as z };
|
|
1793
|
+
export type { HeadingOptions as H, ImageOptions as I, ParagraphOptions as P, TableRowOptions as T };
|