@docen/extensions 0.0.10 → 0.0.11

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.
@@ -1,1863 +0,0 @@
1
- import { N as Node, a as Node$1, P as ParentConfig, E as EditorView, b as NodeView, R as ResizableNodeViewDirection, c as PluginKey, d as Editor, e as Range, T as Transaction, f as EditorState, g as ResolvedPos, D as DOMOutputSpec, M as Mark, h as Extension } from './extensions.BOBBi1Z_.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
- * A function that returns a boolean to indicate if the suggestion should be active.
830
- * This is useful to prevent suggestions from opening for remote users in collaborative environments.
831
- * @param props The props object.
832
- * @param props.editor The editor instance.
833
- * @param props.range The range of the suggestion.
834
- * @param props.query The current suggestion query.
835
- * @param props.text The current suggestion text.
836
- * @param props.transaction The current transaction.
837
- * @returns {boolean}
838
- * @example ({ transaction }) => isChangeOrigin(transaction)
839
- */
840
- shouldShow?: (props: {
841
- editor: Editor;
842
- range: Range;
843
- query: string;
844
- text: string;
845
- transaction: Transaction;
846
- }) => boolean;
847
- /**
848
- * The editor instance.
849
- * @default null
850
- */
851
- editor: Editor;
852
- /**
853
- * The character that triggers the suggestion.
854
- * @default '@'
855
- * @example '#'
856
- */
857
- char?: string;
858
- /**
859
- * Allow spaces in the suggestion query. Not compatible with `allowToIncludeChar`. Will be disabled if `allowToIncludeChar` is set to `true`.
860
- * @default false
861
- * @example true
862
- */
863
- allowSpaces?: boolean;
864
- /**
865
- * Allow the character to be included in the suggestion query. Not compatible with `allowSpaces`.
866
- * @default false
867
- */
868
- allowToIncludeChar?: boolean;
869
- /**
870
- * Allow prefixes in the suggestion query.
871
- * @default [' ']
872
- * @example [' ', '@']
873
- */
874
- allowedPrefixes?: string[] | null;
875
- /**
876
- * Only match suggestions at the start of the line.
877
- * @default false
878
- * @example true
879
- */
880
- startOfLine?: boolean;
881
- /**
882
- * The tag name of the decoration node.
883
- * @default 'span'
884
- * @example 'div'
885
- */
886
- decorationTag?: string;
887
- /**
888
- * The class name of the decoration node.
889
- * @default 'suggestion'
890
- * @example 'mention'
891
- */
892
- decorationClass?: string;
893
- /**
894
- * Creates a decoration with the provided content.
895
- * @param decorationContent - The content to display in the decoration
896
- * @default "" - Creates an empty decoration if no content provided
897
- */
898
- decorationContent?: string;
899
- /**
900
- * The class name of the decoration node when it is empty.
901
- * @default 'is-empty'
902
- * @example 'is-empty'
903
- */
904
- decorationEmptyClass?: string;
905
- /**
906
- * A function that is called when a suggestion is selected.
907
- * @param props The props object.
908
- * @param props.editor The editor instance.
909
- * @param props.range The range of the suggestion.
910
- * @param props.props The props of the selected suggestion.
911
- * @returns void
912
- * @example ({ editor, range, props }) => { props.command(props.props) }
913
- */
914
- command?: (props: {
915
- editor: Editor;
916
- range: Range;
917
- props: TSelected;
918
- }) => void;
919
- /**
920
- * A function that returns the suggestion items in form of an array.
921
- * @param props The props object.
922
- * @param props.editor The editor instance.
923
- * @param props.query The current suggestion query.
924
- * @returns An array of suggestion items.
925
- * @example ({ editor, query }) => [{ id: 1, label: 'John Doe' }]
926
- */
927
- items?: (props: {
928
- query: string;
929
- editor: Editor;
930
- }) => I[] | Promise<I[]>;
931
- /**
932
- * The render function for the suggestion.
933
- * @returns An object with render functions.
934
- */
935
- render?: () => {
936
- onBeforeStart?: (props: SuggestionProps<I, TSelected>) => void;
937
- onStart?: (props: SuggestionProps<I, TSelected>) => void;
938
- onBeforeUpdate?: (props: SuggestionProps<I, TSelected>) => void;
939
- onUpdate?: (props: SuggestionProps<I, TSelected>) => void;
940
- onExit?: (props: SuggestionProps<I, TSelected>) => void;
941
- onKeyDown?: (props: SuggestionKeyDownProps) => boolean;
942
- };
943
- /**
944
- * A function that returns a boolean to indicate if the suggestion should be active.
945
- * @param props The props object.
946
- * @returns {boolean}
947
- */
948
- allow?: (props: {
949
- editor: Editor;
950
- state: EditorState;
951
- range: Range;
952
- isActive?: boolean;
953
- }) => boolean;
954
- findSuggestionMatch?: typeof findSuggestionMatch;
955
- }
956
- interface SuggestionProps<I = any, TSelected = any> {
957
- /**
958
- * The editor instance.
959
- */
960
- editor: Editor;
961
- /**
962
- * The range of the suggestion.
963
- */
964
- range: Range;
965
- /**
966
- * The current suggestion query.
967
- */
968
- query: string;
969
- /**
970
- * The current suggestion text.
971
- */
972
- text: string;
973
- /**
974
- * The suggestion items array.
975
- */
976
- items: I[];
977
- /**
978
- * A function that is called when a suggestion is selected.
979
- * @param props The props object.
980
- * @returns void
981
- */
982
- command: (props: TSelected) => void;
983
- /**
984
- * The decoration node HTML element
985
- * @default null
986
- */
987
- decorationNode: Element | null;
988
- /**
989
- * The function that returns the client rect
990
- * @default null
991
- * @example () => new DOMRect(0, 0, 0, 0)
992
- */
993
- clientRect?: (() => DOMRect | null) | null;
994
- }
995
- interface SuggestionKeyDownProps {
996
- view: EditorView;
997
- event: KeyboardEvent;
998
- range: Range;
999
- }
1000
-
1001
- declare module '@tiptap/core' {
1002
- interface Commands<ReturnType> {
1003
- emoji: {
1004
- /**
1005
- * Add an emoji
1006
- */
1007
- setEmoji: (shortcode: string) => ReturnType;
1008
- };
1009
- }
1010
- interface Storage {
1011
- emoji: EmojiStorage;
1012
- }
1013
- }
1014
- type EmojiItem = {
1015
- /**
1016
- * A unique name of the emoji which will be stored as attribute
1017
- */
1018
- name: string;
1019
- /**
1020
- * The emoji unicode character
1021
- */
1022
- emoji?: string;
1023
- /**
1024
- * A list of unique shortcodes that are used by input rules to find the emoji
1025
- */
1026
- shortcodes: string[];
1027
- /**
1028
- * A list of tags that can help for searching emojis
1029
- */
1030
- tags: string[];
1031
- /**
1032
- * A name that can help to group emojis
1033
- */
1034
- group?: string;
1035
- /**
1036
- * A list of unique emoticons
1037
- */
1038
- emoticons?: string[];
1039
- /**
1040
- * The unicode version the emoji was introduced
1041
- */
1042
- version?: number;
1043
- /**
1044
- * A fallback image if the current system doesn't support the emoji or for custom emojis
1045
- */
1046
- fallbackImage?: string;
1047
- /**
1048
- * Store some custom data
1049
- */
1050
- [key: string]: any;
1051
- };
1052
- type EmojiOptions = {
1053
- HTMLAttributes: Record<string, any>;
1054
- emojis: EmojiItem[];
1055
- enableEmoticons: boolean;
1056
- forceFallbackImages: boolean;
1057
- suggestion: Omit<SuggestionOptions, 'editor'>;
1058
- };
1059
- type EmojiStorage = {
1060
- emojis: EmojiItem[];
1061
- isSupported: (item: EmojiItem) => boolean;
1062
- };
1063
- declare const Emoji: Node<EmojiOptions, EmojiStorage>;
1064
-
1065
- interface MentionNodeAttrs {
1066
- /**
1067
- * The identifier for the selected item that was mentioned, stored as a `data-id`
1068
- * attribute.
1069
- */
1070
- id: string | null;
1071
- /**
1072
- * The label to be rendered by the editor as the displayed text for this mentioned
1073
- * item, if provided. Stored as a `data-label` attribute. See `renderLabel`.
1074
- */
1075
- label?: string | null;
1076
- /**
1077
- * The character that triggers the suggestion, stored as
1078
- * `data-mention-suggestion-char` attribute.
1079
- */
1080
- mentionSuggestionChar?: string;
1081
- }
1082
- interface MentionOptions<SuggestionItem = any, Attrs extends Record<string, any> = MentionNodeAttrs> {
1083
- /**
1084
- * The HTML attributes for a mention node.
1085
- * @default {}
1086
- * @example { class: 'foo' }
1087
- */
1088
- HTMLAttributes: Record<string, any>;
1089
- /**
1090
- * A function to render the label of a mention.
1091
- * @deprecated use renderText and renderHTML instead
1092
- * @param props The render props
1093
- * @returns The label
1094
- * @example ({ options, node }) => `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`
1095
- */
1096
- renderLabel?: (props: {
1097
- options: MentionOptions<SuggestionItem, Attrs>;
1098
- node: Node$1;
1099
- suggestion: SuggestionOptions | null;
1100
- }) => string;
1101
- /**
1102
- * A function to render the text of a mention.
1103
- * @param props The render props
1104
- * @returns The text
1105
- * @example ({ options, node }) => `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`
1106
- */
1107
- renderText: (props: {
1108
- options: MentionOptions<SuggestionItem, Attrs>;
1109
- node: Node$1;
1110
- suggestion: SuggestionOptions | null;
1111
- }) => string;
1112
- /**
1113
- * A function to render the HTML of a mention.
1114
- * @param props The render props
1115
- * @returns The HTML as a ProseMirror DOM Output Spec
1116
- * @example ({ options, node }) => ['span', { 'data-type': 'mention' }, `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`]
1117
- */
1118
- renderHTML: (props: {
1119
- options: MentionOptions<SuggestionItem, Attrs>;
1120
- node: Node$1;
1121
- suggestion: SuggestionOptions | null;
1122
- }) => DOMOutputSpec;
1123
- /**
1124
- * Whether to delete the trigger character with backspace.
1125
- * @default false
1126
- */
1127
- deleteTriggerWithBackspace: boolean;
1128
- /**
1129
- * The suggestion options, when you want to support multiple triggers.
1130
- *
1131
- * With this parameter, you can define multiple types of mention. For example, you can use the `@` character
1132
- * to mention users and the `#` character to mention tags.
1133
- *
1134
- * @default [{ char: '@', pluginKey: MentionPluginKey }]
1135
- * @example [{ char: '@', pluginKey: MentionPluginKey }, { char: '#', pluginKey: new PluginKey('hashtag') }]
1136
- */
1137
- suggestions: Array<Omit<SuggestionOptions<SuggestionItem, Attrs>, 'editor'>>;
1138
- /**
1139
- * The suggestion options, when you want to support only one trigger. To support multiple triggers, use the
1140
- * `suggestions` parameter instead.
1141
- *
1142
- * @default {}
1143
- * @example { char: '@', pluginKey: MentionPluginKey, command: ({ editor, range, props }) => { ... } }
1144
- */
1145
- suggestion: Omit<SuggestionOptions<SuggestionItem, Attrs>, 'editor'>;
1146
- }
1147
- /**
1148
- * This extension allows you to insert mentions into the editor.
1149
- * @see https://www.tiptap.dev/api/extensions/mention
1150
- */
1151
- declare const Mention: Node<MentionOptions<any, MentionNodeAttrs>, any>;
1152
-
1153
- /** @jsxImportSource @tiptap/core */
1154
-
1155
- interface BoldOptions {
1156
- /**
1157
- * HTML attributes to add to the bold element.
1158
- * @default {}
1159
- * @example { class: 'foo' }
1160
- */
1161
- HTMLAttributes: Record<string, any>;
1162
- }
1163
- declare module '@tiptap/core' {
1164
- interface Commands<ReturnType> {
1165
- bold: {
1166
- /**
1167
- * Set a bold mark
1168
- */
1169
- setBold: () => ReturnType;
1170
- /**
1171
- * Toggle a bold mark
1172
- */
1173
- toggleBold: () => ReturnType;
1174
- /**
1175
- * Unset a bold mark
1176
- */
1177
- unsetBold: () => ReturnType;
1178
- };
1179
- }
1180
- }
1181
- /**
1182
- * This extension allows you to mark text as bold.
1183
- * @see https://tiptap.dev/api/marks/bold
1184
- */
1185
- declare const Bold: Mark<BoldOptions, any>;
1186
-
1187
- interface ItalicOptions {
1188
- /**
1189
- * HTML attributes to add to the italic element.
1190
- * @default {}
1191
- * @example { class: 'foo' }
1192
- */
1193
- HTMLAttributes: Record<string, any>;
1194
- }
1195
- declare module '@tiptap/core' {
1196
- interface Commands<ReturnType> {
1197
- italic: {
1198
- /**
1199
- * Set an italic mark
1200
- * @example editor.commands.setItalic()
1201
- */
1202
- setItalic: () => ReturnType;
1203
- /**
1204
- * Toggle an italic mark
1205
- * @example editor.commands.toggleItalic()
1206
- */
1207
- toggleItalic: () => ReturnType;
1208
- /**
1209
- * Unset an italic mark
1210
- * @example editor.commands.unsetItalic()
1211
- */
1212
- unsetItalic: () => ReturnType;
1213
- };
1214
- }
1215
- }
1216
- /**
1217
- * This extension allows you to create italic text.
1218
- * @see https://www.tiptap.dev/api/marks/italic
1219
- */
1220
- declare const Italic: Mark<ItalicOptions, any>;
1221
-
1222
- interface UnderlineOptions {
1223
- /**
1224
- * HTML attributes to add to the underline element.
1225
- * @default {}
1226
- * @example { class: 'foo' }
1227
- */
1228
- HTMLAttributes: Record<string, any>;
1229
- }
1230
- declare module '@tiptap/core' {
1231
- interface Commands<ReturnType> {
1232
- underline: {
1233
- /**
1234
- * Set an underline mark
1235
- * @example editor.commands.setUnderline()
1236
- */
1237
- setUnderline: () => ReturnType;
1238
- /**
1239
- * Toggle an underline mark
1240
- * @example editor.commands.toggleUnderline()
1241
- */
1242
- toggleUnderline: () => ReturnType;
1243
- /**
1244
- * Unset an underline mark
1245
- * @example editor.commands.unsetUnderline()
1246
- */
1247
- unsetUnderline: () => ReturnType;
1248
- };
1249
- }
1250
- }
1251
- /**
1252
- * This extension allows you to create underline text.
1253
- * @see https://www.tiptap.dev/api/marks/underline
1254
- */
1255
- declare const Underline: Mark<UnderlineOptions, any>;
1256
-
1257
- interface StrikeOptions {
1258
- /**
1259
- * HTML attributes to add to the strike element.
1260
- * @default {}
1261
- * @example { class: 'foo' }
1262
- */
1263
- HTMLAttributes: Record<string, any>;
1264
- }
1265
- declare module '@tiptap/core' {
1266
- interface Commands<ReturnType> {
1267
- strike: {
1268
- /**
1269
- * Set a strike mark
1270
- * @example editor.commands.setStrike()
1271
- */
1272
- setStrike: () => ReturnType;
1273
- /**
1274
- * Toggle a strike mark
1275
- * @example editor.commands.toggleStrike()
1276
- */
1277
- toggleStrike: () => ReturnType;
1278
- /**
1279
- * Unset a strike mark
1280
- * @example editor.commands.unsetStrike()
1281
- */
1282
- unsetStrike: () => ReturnType;
1283
- };
1284
- }
1285
- }
1286
- /**
1287
- * This extension allows you to create strike text.
1288
- * @see https://www.tiptap.dev/api/marks/strike
1289
- */
1290
- declare const Strike: Mark<StrikeOptions, any>;
1291
-
1292
- interface CodeOptions {
1293
- /**
1294
- * The HTML attributes applied to the code element.
1295
- * @default {}
1296
- * @example { class: 'foo' }
1297
- */
1298
- HTMLAttributes: Record<string, any>;
1299
- }
1300
- declare module '@tiptap/core' {
1301
- interface Commands<ReturnType> {
1302
- code: {
1303
- /**
1304
- * Set a code mark
1305
- */
1306
- setCode: () => ReturnType;
1307
- /**
1308
- * Toggle inline code
1309
- */
1310
- toggleCode: () => ReturnType;
1311
- /**
1312
- * Unset a code mark
1313
- */
1314
- unsetCode: () => ReturnType;
1315
- };
1316
- }
1317
- }
1318
- /**
1319
- * This extension allows you to mark text as inline code.
1320
- * @see https://tiptap.dev/api/marks/code
1321
- */
1322
- declare const Code: Mark<CodeOptions, any>;
1323
-
1324
- interface LinkProtocolOptions {
1325
- /**
1326
- * The protocol scheme to be registered.
1327
- * @default '''
1328
- * @example 'ftp'
1329
- * @example 'git'
1330
- */
1331
- scheme: string;
1332
- /**
1333
- * If enabled, it allows optional slashes after the protocol.
1334
- * @default false
1335
- * @example true
1336
- */
1337
- optionalSlashes?: boolean;
1338
- }
1339
- /**
1340
- * @deprecated The default behavior is now to open links when the editor is not editable.
1341
- */
1342
- type DeprecatedOpenWhenNotEditable = 'whenNotEditable';
1343
- interface LinkOptions {
1344
- /**
1345
- * If enabled, the extension will automatically add links as you type.
1346
- * @default true
1347
- * @example false
1348
- */
1349
- autolink: boolean;
1350
- /**
1351
- * An array of custom protocols to be registered with linkifyjs.
1352
- * @default []
1353
- * @example ['ftp', 'git']
1354
- */
1355
- protocols: Array<LinkProtocolOptions | string>;
1356
- /**
1357
- * Default protocol to use when no protocol is specified.
1358
- * @default 'http'
1359
- */
1360
- defaultProtocol: string;
1361
- /**
1362
- * If enabled, links will be opened on click.
1363
- * @default true
1364
- * @example false
1365
- */
1366
- openOnClick: boolean | DeprecatedOpenWhenNotEditable;
1367
- /**
1368
- * If enabled, the link will be selected when clicked.
1369
- * @default false
1370
- * @example true
1371
- */
1372
- enableClickSelection: boolean;
1373
- /**
1374
- * Adds a link to the current selection if the pasted content only contains an url.
1375
- * @default true
1376
- * @example false
1377
- */
1378
- linkOnPaste: boolean;
1379
- /**
1380
- * HTML attributes to add to the link element.
1381
- * @default {}
1382
- * @example { class: 'foo' }
1383
- */
1384
- HTMLAttributes: Record<string, any>;
1385
- /**
1386
- * @deprecated Use the `shouldAutoLink` option instead.
1387
- * A validation function that modifies link verification for the auto linker.
1388
- * @param url - The url to be validated.
1389
- * @returns - True if the url is valid, false otherwise.
1390
- */
1391
- validate: (url: string) => boolean;
1392
- /**
1393
- * A validation function which is used for configuring link verification for preventing XSS attacks.
1394
- * Only modify this if you know what you're doing.
1395
- *
1396
- * @returns {boolean} `true` if the URL is valid, `false` otherwise.
1397
- *
1398
- * @example
1399
- * isAllowedUri: (url, { defaultValidate, protocols, defaultProtocol }) => {
1400
- * return url.startsWith('./') || defaultValidate(url)
1401
- * }
1402
- */
1403
- isAllowedUri: (
1404
- /**
1405
- * The URL to be validated.
1406
- */
1407
- url: string, ctx: {
1408
- /**
1409
- * The default validation function.
1410
- */
1411
- defaultValidate: (url: string) => boolean;
1412
- /**
1413
- * An array of allowed protocols for the URL (e.g., "http", "https"). As defined in the `protocols` option.
1414
- */
1415
- protocols: Array<LinkProtocolOptions | string>;
1416
- /**
1417
- * A string that represents the default protocol (e.g., 'http'). As defined in the `defaultProtocol` option.
1418
- */
1419
- defaultProtocol: string;
1420
- }) => boolean;
1421
- /**
1422
- * Determines whether a valid link should be automatically linked in the content.
1423
- *
1424
- * @param {string} url - The URL that has already been validated.
1425
- * @returns {boolean} - True if the link should be auto-linked; false if it should not be auto-linked.
1426
- */
1427
- shouldAutoLink: (url: string) => boolean;
1428
- }
1429
- declare module '@tiptap/core' {
1430
- interface Commands<ReturnType> {
1431
- link: {
1432
- /**
1433
- * Set a link mark
1434
- * @param attributes The link attributes
1435
- * @example editor.commands.setLink({ href: 'https://tiptap.dev' })
1436
- */
1437
- setLink: (attributes: {
1438
- href: string;
1439
- target?: string | null;
1440
- rel?: string | null;
1441
- class?: string | null;
1442
- title?: string | null;
1443
- }) => ReturnType;
1444
- /**
1445
- * Toggle a link mark
1446
- * @param attributes The link attributes
1447
- * @example editor.commands.toggleLink({ href: 'https://tiptap.dev' })
1448
- */
1449
- toggleLink: (attributes?: {
1450
- href: string;
1451
- target?: string | null;
1452
- rel?: string | null;
1453
- class?: string | null;
1454
- title?: string | null;
1455
- }) => ReturnType;
1456
- /**
1457
- * Unset a link mark
1458
- * @example editor.commands.unsetLink()
1459
- */
1460
- unsetLink: () => ReturnType;
1461
- };
1462
- }
1463
- }
1464
- /**
1465
- * This extension allows you to create links.
1466
- * @see https://www.tiptap.dev/api/marks/link
1467
- */
1468
- declare const Link: Mark<LinkOptions, any>;
1469
-
1470
- interface HighlightOptions {
1471
- /**
1472
- * Allow multiple highlight colors
1473
- * @default false
1474
- * @example true
1475
- */
1476
- multicolor: boolean;
1477
- /**
1478
- * HTML attributes to add to the highlight element.
1479
- * @default {}
1480
- * @example { class: 'foo' }
1481
- */
1482
- HTMLAttributes: Record<string, any>;
1483
- }
1484
- declare module '@tiptap/core' {
1485
- interface Commands<ReturnType> {
1486
- highlight: {
1487
- /**
1488
- * Set a highlight mark
1489
- * @param attributes The highlight attributes
1490
- * @example editor.commands.setHighlight({ color: 'red' })
1491
- */
1492
- setHighlight: (attributes?: {
1493
- color: string;
1494
- }) => ReturnType;
1495
- /**
1496
- * Toggle a highlight mark
1497
- * @param attributes The highlight attributes
1498
- * @example editor.commands.toggleHighlight({ color: 'red' })
1499
- */
1500
- toggleHighlight: (attributes?: {
1501
- color: string;
1502
- }) => ReturnType;
1503
- /**
1504
- * Unset a highlight mark
1505
- * @example editor.commands.unsetHighlight()
1506
- */
1507
- unsetHighlight: () => ReturnType;
1508
- };
1509
- }
1510
- }
1511
- /**
1512
- * This extension allows you to highlight text.
1513
- * @see https://www.tiptap.dev/api/marks/highlight
1514
- */
1515
- declare const Highlight: Mark<HighlightOptions, any>;
1516
-
1517
- interface SubscriptExtensionOptions {
1518
- /**
1519
- * HTML attributes to add to the subscript element.
1520
- * @default {}
1521
- * @example { class: 'foo' }
1522
- */
1523
- HTMLAttributes: Record<string, any>;
1524
- }
1525
- declare module '@tiptap/core' {
1526
- interface Commands<ReturnType> {
1527
- subscript: {
1528
- /**
1529
- * Set a subscript mark
1530
- * @example editor.commands.setSubscript()
1531
- */
1532
- setSubscript: () => ReturnType;
1533
- /**
1534
- * Toggle a subscript mark
1535
- * @example editor.commands.toggleSubscript()
1536
- */
1537
- toggleSubscript: () => ReturnType;
1538
- /**
1539
- * Unset a subscript mark
1540
- * @example editor.commands.unsetSubscript()
1541
- */
1542
- unsetSubscript: () => ReturnType;
1543
- };
1544
- }
1545
- }
1546
- /**
1547
- * This extension allows you to create subscript text.
1548
- * @see https://www.tiptap.dev/api/marks/subscript
1549
- */
1550
- declare const Subscript: Mark<SubscriptExtensionOptions, any>;
1551
-
1552
- interface SuperscriptExtensionOptions {
1553
- /**
1554
- * HTML attributes to add to the superscript element.
1555
- * @default {}
1556
- * @example { class: 'foo' }
1557
- */
1558
- HTMLAttributes: Record<string, any>;
1559
- }
1560
- declare module '@tiptap/core' {
1561
- interface Commands<ReturnType> {
1562
- superscript: {
1563
- /**
1564
- * Set a superscript mark
1565
- * @example editor.commands.setSuperscript()
1566
- */
1567
- setSuperscript: () => ReturnType;
1568
- /**
1569
- * Toggle a superscript mark
1570
- * @example editor.commands.toggleSuperscript()
1571
- */
1572
- toggleSuperscript: () => ReturnType;
1573
- /**
1574
- * Unset a superscript mark
1575
- * @example editor.commands.unsetSuperscript()
1576
- */
1577
- unsetSuperscript: () => ReturnType;
1578
- };
1579
- }
1580
- }
1581
- /**
1582
- * This extension allows you to create superscript text.
1583
- * @see https://www.tiptap.dev/api/marks/superscript
1584
- */
1585
- declare const Superscript: Mark<SuperscriptExtensionOptions, any>;
1586
-
1587
- interface TextStyleOptions {
1588
- /**
1589
- * HTML attributes to add to the span element.
1590
- * @default {}
1591
- * @example { class: 'foo' }
1592
- */
1593
- HTMLAttributes: Record<string, any>;
1594
- /**
1595
- * When enabled, merges the styles of nested spans into the child span during HTML parsing.
1596
- * This prioritizes the style of the child span.
1597
- * Used when parsing content created in other editors.
1598
- * (Fix for ProseMirror's default behavior.)
1599
- * @default true
1600
- */
1601
- mergeNestedSpanStyles: boolean;
1602
- }
1603
- /**
1604
- * This extension allows you to create text styles. It is required by default
1605
- * for the `text-color` and `font-family` extensions.
1606
- * @see https://www.tiptap.dev/api/marks/text-style
1607
- */
1608
- declare const TextStyle: Mark<TextStyleOptions, any>;
1609
-
1610
- type BackgroundColorOptions = {
1611
- /**
1612
- * The types where the color can be applied
1613
- * @default ['textStyle']
1614
- * @example ['heading', 'paragraph']
1615
- */
1616
- types: string[];
1617
- };
1618
- /**
1619
- * This extension allows you to color your text.
1620
- * @see https://tiptap.dev/api/extensions/background-color
1621
- */
1622
- declare const BackgroundColor: Extension<BackgroundColorOptions, any>;
1623
-
1624
- type ColorOptions = {
1625
- /**
1626
- * The types where the color can be applied
1627
- * @default ['textStyle']
1628
- * @example ['heading', 'paragraph']
1629
- */
1630
- types: string[];
1631
- };
1632
- /**
1633
- * This extension allows you to color your text.
1634
- * @see https://tiptap.dev/api/extensions/color
1635
- */
1636
- declare const Color: Extension<ColorOptions, any>;
1637
-
1638
- type FontFamilyOptions = {
1639
- /**
1640
- * A list of node names where the font family can be applied.
1641
- * @default ['textStyle']
1642
- * @example ['heading', 'paragraph']
1643
- */
1644
- types: string[];
1645
- };
1646
- /**
1647
- * This extension allows you to set a font family for text.
1648
- * @see https://www.tiptap.dev/api/extensions/font-family
1649
- */
1650
- declare const FontFamily: Extension<FontFamilyOptions, any>;
1651
-
1652
- type FontSizeOptions = {
1653
- /**
1654
- * A list of node names where the font size can be applied.
1655
- * @default ['textStyle']
1656
- * @example ['heading', 'paragraph']
1657
- */
1658
- types: string[];
1659
- };
1660
- /**
1661
- * This extension allows you to set a font size for text.
1662
- * @see https://www.tiptap.dev/api/extensions/font-size
1663
- */
1664
- declare const FontSize: Extension<FontSizeOptions, any>;
1665
-
1666
- type LineHeightOptions = {
1667
- /**
1668
- * A list of node names where the line height can be applied.
1669
- * @default ['textStyle']
1670
- * @example ['heading', 'paragraph']
1671
- */
1672
- types: string[];
1673
- };
1674
- declare module '@tiptap/core' {
1675
- interface Commands<ReturnType> {
1676
- textStyle: {
1677
- /**
1678
- * Remove spans without inline style attributes.
1679
- * @example editor.commands.removeEmptyTextStyle()
1680
- */
1681
- removeEmptyTextStyle: () => ReturnType;
1682
- /**
1683
- * Toggle a text style
1684
- * @param attributes The text style attributes
1685
- * @example editor.commands.toggleTextStyle({ fontWeight: 'bold' })
1686
- */
1687
- toggleTextStyle: (attributes?: TextStyleAttributes) => ReturnType;
1688
- };
1689
- }
1690
- }
1691
- declare module '@tiptap/core' {
1692
- interface Commands<ReturnType> {
1693
- backgroundColor: {
1694
- /**
1695
- * Set the text color
1696
- * @param backgroundColor The color to set
1697
- * @example editor.commands.setColor('red')
1698
- */
1699
- setBackgroundColor: (backgroundColor: string) => ReturnType;
1700
- /**
1701
- * Unset the text backgroundColor
1702
- * @example editor.commands.unsetBackgroundColor()
1703
- */
1704
- unsetBackgroundColor: () => ReturnType;
1705
- };
1706
- }
1707
- }
1708
- declare module '@tiptap/core' {
1709
- interface Commands<ReturnType> {
1710
- color: {
1711
- /**
1712
- * Set the text color
1713
- * @param color The color to set
1714
- * @example editor.commands.setColor('red')
1715
- */
1716
- setColor: (color: string) => ReturnType;
1717
- /**
1718
- * Unset the text color
1719
- * @example editor.commands.unsetColor()
1720
- */
1721
- unsetColor: () => ReturnType;
1722
- };
1723
- }
1724
- }
1725
- declare module '@tiptap/core' {
1726
- interface Commands<ReturnType> {
1727
- fontFamily: {
1728
- /**
1729
- * Set the font family
1730
- * @param fontFamily The font family
1731
- * @example editor.commands.setFontFamily('Arial')
1732
- */
1733
- setFontFamily: (fontFamily: string) => ReturnType;
1734
- /**
1735
- * Unset the font family
1736
- * @example editor.commands.unsetFontFamily()
1737
- */
1738
- unsetFontFamily: () => ReturnType;
1739
- };
1740
- }
1741
- }
1742
- declare module '@tiptap/core' {
1743
- interface Commands<ReturnType> {
1744
- fontSize: {
1745
- /**
1746
- * Set the font size
1747
- * @param fontSize The font size
1748
- * @example editor.commands.setFontSize('16px')
1749
- */
1750
- setFontSize: (fontSize: string) => ReturnType;
1751
- /**
1752
- * Unset the font size
1753
- * @example editor.commands.unsetFontSize()
1754
- */
1755
- unsetFontSize: () => ReturnType;
1756
- };
1757
- }
1758
- }
1759
- declare module '@tiptap/core' {
1760
- interface Commands<ReturnType> {
1761
- lineHeight: {
1762
- /**
1763
- * Set the line height
1764
- * @param lineHeight The line height
1765
- * @example editor.commands.setLineHeight('1.5')
1766
- */
1767
- setLineHeight: (lineHeight: string) => ReturnType;
1768
- /**
1769
- * Unset the line height
1770
- * @example editor.commands.unsetLineHeight()
1771
- */
1772
- unsetLineHeight: () => ReturnType;
1773
- };
1774
- }
1775
- }
1776
- declare module '@tiptap/extension-text-style' {
1777
- interface TextStyleAttributes {
1778
- backgroundColor?: string | null;
1779
- }
1780
- }
1781
- declare module '@tiptap/extension-text-style' {
1782
- interface TextStyleAttributes {
1783
- color?: string | null;
1784
- }
1785
- }
1786
- declare module '@tiptap/extension-text-style' {
1787
- interface TextStyleAttributes {
1788
- fontFamily?: string | null;
1789
- }
1790
- }
1791
- declare module '@tiptap/extension-text-style' {
1792
- interface TextStyleAttributes {
1793
- fontSize?: string | null;
1794
- }
1795
- }
1796
- declare module '@tiptap/extension-text-style' {
1797
- interface TextStyleAttributes {
1798
- lineHeight?: string | null;
1799
- }
1800
- }
1801
- /**
1802
- * This extension allows you to set the line-height for text.
1803
- * @see https://www.tiptap.dev/api/extensions/line-height
1804
- */
1805
- declare const LineHeight: Extension<LineHeightOptions, any>;
1806
-
1807
- /**
1808
- * The available text style attributes.
1809
- */
1810
- interface TextStyleAttributes extends Record<string, any> {
1811
- }
1812
-
1813
- interface TextAlignOptions {
1814
- /**
1815
- * The types where the text align attribute can be applied.
1816
- * @default []
1817
- * @example ['heading', 'paragraph']
1818
- */
1819
- types: string[];
1820
- /**
1821
- * The alignments which are allowed.
1822
- * @default ['left', 'center', 'right', 'justify']
1823
- * @example ['left', 'right']
1824
- */
1825
- alignments: string[];
1826
- /**
1827
- * The default alignment.
1828
- * @default null
1829
- * @example 'center'
1830
- */
1831
- defaultAlignment: string | null;
1832
- }
1833
- declare module '@tiptap/core' {
1834
- interface Commands<ReturnType> {
1835
- textAlign: {
1836
- /**
1837
- * Set the text align attribute
1838
- * @param alignment The alignment
1839
- * @example editor.commands.setTextAlign('left')
1840
- */
1841
- setTextAlign: (alignment: string) => ReturnType;
1842
- /**
1843
- * Unset the text align attribute
1844
- * @example editor.commands.unsetTextAlign()
1845
- */
1846
- unsetTextAlign: () => ReturnType;
1847
- /**
1848
- * Toggle the text align attribute
1849
- * @param alignment The alignment
1850
- * @example editor.commands.toggleTextAlign('right')
1851
- */
1852
- toggleTextAlign: (alignment: string) => ReturnType;
1853
- };
1854
- }
1855
- }
1856
- /**
1857
- * This extension allows you to align text.
1858
- * @see https://www.tiptap.dev/api/extensions/text-align
1859
- */
1860
- declare const TextAlign: Extension<TextAlignOptions, any>;
1861
-
1862
- export { Image as A, BackgroundColor as B, Code as C, Details as D, Emoji as E, FontFamily as F, Paragraph as G, TableRow as J, LineHeight as L, Mention as M, OrderedList as O, Strike as S, Underline as U, Blockquote as a, Bold as b, BulletList as c, CodeBlockLowlight as d, Color as e, DetailsContent as f, DetailsSummary as g, Document as h, FontSize as i, HardBreak as j, Highlight as k, HorizontalRule as l, Italic as m, Link as n, ListItem as o, Subscript as p, Superscript as q, Table as r, TableCell as s, TableHeader as t, TaskItem as u, TaskList as v, Text as w, TextAlign as x, TextStyle as y, Heading as z };
1863
- export type { HeadingOptions as H, ImageOptions as I, ParagraphOptions as P, TableRowOptions as T };