reactjs-tiptap-editor-pro 0.2.35 → 0.2.37

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/lib/index.d.cts CHANGED
@@ -3,12 +3,16 @@ import { BubbleMenu } from '@tiptap/react';
3
3
  import { default as default_2 } from 'react';
4
4
  import { Editor } from '@tiptap/react';
5
5
  import { Editor as Editor_2 } from '@tiptap/core';
6
+ import { EditorState } from '@tiptap/pm/state';
7
+ import { EditorView } from '@tiptap/pm/view';
6
8
  import { ForwardRefExoticComponent } from 'react';
7
9
  import { RefAttributes } from 'react';
8
10
  import { TooltipContentProps } from '@radix-ui/react-tooltip';
9
11
  import { UseEditorOptions } from '@tiptap/react';
10
12
 
11
- declare interface ActionButtonProps {
13
+ export declare const ActionButton: default_2.ForwardRefExoticComponent<Partial<ActionButtonProps> & default_2.RefAttributes<HTMLButtonElement>>;
14
+
15
+ export declare interface ActionButtonProps {
12
16
  icon?: string;
13
17
  title?: string;
14
18
  tooltip?: string;
@@ -73,6 +77,8 @@ declare interface BubbleMenuProps {
73
77
  */
74
78
  hidden?: boolean;
75
79
  items?: string[];
80
+ filterItem?: (item: any, editor: Editor) => boolean;
81
+ showShow?: (props: ShouldShowProps) => boolean;
76
82
  };
77
83
  imageConfig?: {
78
84
  /**
@@ -219,6 +225,15 @@ declare interface RichTextEditorProps {
219
225
  resetCSS?: boolean;
220
226
  }
221
227
 
228
+ declare interface ShouldShowProps {
229
+ editor: Editor;
230
+ view: EditorView;
231
+ state?: EditorState;
232
+ oldState?: EditorState;
233
+ from?: number;
234
+ to?: number;
235
+ }
236
+
222
237
  /**
223
238
  * Represents the ToolbarItemProps.
224
239
  */
@@ -275,17 +290,19 @@ declare module '@tiptap/core' {
275
290
 
276
291
  declare module '@tiptap/core' {
277
292
  interface Commands<ReturnType> {
278
- fontSize: {
293
+ imageUpload: {
279
294
  /**
280
- * Set the text font size. ex: "12px", "2em", or "small". Must be a valid
281
- * CSS font-size
282
- * (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size).
295
+ * Add an image
283
296
  */
284
- setFontSize: (fontSize: string) => ReturnType;
297
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
285
298
  /**
286
- * Unset the font size
299
+ * Update an image
287
300
  */
288
- unsetFontSize: () => ReturnType;
301
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
302
+ /**
303
+ * Set image alignment
304
+ */
305
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
289
306
  };
290
307
  }
291
308
  }
@@ -293,9 +310,14 @@ declare module '@tiptap/core' {
293
310
 
294
311
  declare module '@tiptap/core' {
295
312
  interface Commands<ReturnType> {
296
- lineHeight: {
297
- setLineHeight: (lineHeight: string) => ReturnType;
298
- unsetLineHeight: () => ReturnType;
313
+ iframe: {
314
+ /**
315
+ * Add an iframe
316
+ */
317
+ setIframe: (options: {
318
+ src: string;
319
+ service: string;
320
+ }) => ReturnType;
299
321
  };
300
322
  }
301
323
  }
@@ -303,19 +325,15 @@ declare module '@tiptap/core' {
303
325
 
304
326
  declare module '@tiptap/core' {
305
327
  interface Commands<ReturnType> {
306
- imageUpload: {
307
- /**
308
- * Add an image
309
- */
310
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
328
+ indent: {
311
329
  /**
312
- * Update an image
330
+ * Set the indent attribute
313
331
  */
314
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
332
+ indent: () => ReturnType;
315
333
  /**
316
- * Set image alignment
334
+ * Set the outdent attribute
317
335
  */
318
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
336
+ outdent: () => ReturnType;
319
337
  };
320
338
  }
321
339
  }
@@ -323,13 +341,9 @@ declare module '@tiptap/core' {
323
341
 
324
342
  declare module '@tiptap/core' {
325
343
  interface Commands<ReturnType> {
326
- columns: {
327
- insertColumns: (attrs?: {
328
- cols: number;
329
- }) => ReturnType;
330
- addColBefore: () => ReturnType;
331
- addColAfter: () => ReturnType;
332
- deleteCol: () => ReturnType;
344
+ lineHeight: {
345
+ setLineHeight: (lineHeight: string) => ReturnType;
346
+ unsetLineHeight: () => ReturnType;
333
347
  };
334
348
  }
335
349
  }
@@ -337,8 +351,11 @@ declare module '@tiptap/core' {
337
351
 
338
352
  declare module '@tiptap/core' {
339
353
  interface Commands<ReturnType> {
340
- painter: {
341
- setPainter: (marks: Mark[]) => ReturnType;
354
+ emoji: {
355
+ setEmoji: (emoji: {
356
+ name: string;
357
+ emoji: string;
358
+ }) => ReturnType;
342
359
  };
343
360
  }
344
361
  }
@@ -346,15 +363,17 @@ declare module '@tiptap/core' {
346
363
 
347
364
  declare module '@tiptap/core' {
348
365
  interface Commands<ReturnType> {
349
- indent: {
366
+ fontSize: {
350
367
  /**
351
- * Set the indent attribute
368
+ * Set the text font size. ex: "12px", "2em", or "small". Must be a valid
369
+ * CSS font-size
370
+ * (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size).
352
371
  */
353
- indent: () => ReturnType;
372
+ setFontSize: (fontSize: string) => ReturnType;
354
373
  /**
355
- * Set the outdent attribute
374
+ * Unset the font size
356
375
  */
357
- outdent: () => ReturnType;
376
+ unsetFontSize: () => ReturnType;
358
377
  };
359
378
  }
360
379
  }
@@ -372,14 +391,9 @@ declare module '@tiptap/core' {
372
391
 
373
392
  declare module '@tiptap/core' {
374
393
  interface Commands<ReturnType> {
375
- search: {
376
- setSearchTerm: (searchTerm: string) => ReturnType;
377
- setReplaceTerm: (replaceTerm: string) => ReturnType;
378
- replace: () => ReturnType;
379
- replaceAll: () => ReturnType;
380
- goToPrevSearchResult: () => void;
381
- goToNextSearchResult: () => void;
382
- setCaseSensitive: (caseSensitive: boolean) => ReturnType;
394
+ tableOfContents: {
395
+ setTableOfContents: () => ReturnType;
396
+ removeTableOfContents: () => ReturnType;
383
397
  };
384
398
  }
385
399
  }
@@ -387,9 +401,8 @@ declare module '@tiptap/core' {
387
401
 
388
402
  declare module '@tiptap/core' {
389
403
  interface Commands<ReturnType> {
390
- tableOfContents: {
391
- setTableOfContents: () => ReturnType;
392
- removeTableOfContents: () => ReturnType;
404
+ exportWord: {
405
+ exportToWord: () => ReturnType;
393
406
  };
394
407
  }
395
408
  }
@@ -397,8 +410,8 @@ declare module '@tiptap/core' {
397
410
 
398
411
  declare module '@tiptap/core' {
399
412
  interface Commands<ReturnType> {
400
- exportWord: {
401
- exportToWord: () => ReturnType;
413
+ painter: {
414
+ setPainter: (marks: Mark[]) => ReturnType;
402
415
  };
403
416
  }
404
417
  }
@@ -406,14 +419,14 @@ declare module '@tiptap/core' {
406
419
 
407
420
  declare module '@tiptap/core' {
408
421
  interface Commands<ReturnType> {
409
- iframe: {
410
- /**
411
- * Add an iframe
412
- */
413
- setIframe: (options: {
414
- src: string;
415
- service: string;
416
- }) => ReturnType;
422
+ search: {
423
+ setSearchTerm: (searchTerm: string) => ReturnType;
424
+ setReplaceTerm: (replaceTerm: string) => ReturnType;
425
+ replace: () => ReturnType;
426
+ replaceAll: () => ReturnType;
427
+ goToPrevSearchResult: () => void;
428
+ goToNextSearchResult: () => void;
429
+ setCaseSensitive: (caseSensitive: boolean) => ReturnType;
417
430
  };
418
431
  }
419
432
  }
@@ -421,19 +434,13 @@ declare module '@tiptap/core' {
421
434
 
422
435
  declare module '@tiptap/core' {
423
436
  interface Commands<ReturnType> {
424
- imageGifUpload: {
425
- /**
426
- * Add an image gif
427
- */
428
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
429
- /**
430
- * Update an image gif
431
- */
432
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
433
- /**
434
- * Set image alignment
435
- */
436
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
437
+ columns: {
438
+ insertColumns: (attrs?: {
439
+ cols: number;
440
+ }) => ReturnType;
441
+ addColBefore: () => ReturnType;
442
+ addColAfter: () => ReturnType;
443
+ deleteCol: () => ReturnType;
437
444
  };
438
445
  }
439
446
  }
@@ -460,9 +467,8 @@ declare module '@tiptap/core' {
460
467
 
461
468
  declare module '@tiptap/core' {
462
469
  interface Commands<ReturnType> {
463
- drawer: {
464
- setDrawer: (options: any, replace?: any) => ReturnType;
465
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
470
+ attachment: {
471
+ setAttachment: (attrs?: unknown) => ReturnType;
466
472
  };
467
473
  }
468
474
  }
@@ -470,11 +476,19 @@ declare module '@tiptap/core' {
470
476
 
471
477
  declare module '@tiptap/core' {
472
478
  interface Commands<ReturnType> {
473
- emoji: {
474
- setEmoji: (emoji: {
475
- name: string;
476
- emoji: string;
477
- }) => ReturnType;
479
+ imageGifUpload: {
480
+ /**
481
+ * Add an image gif
482
+ */
483
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
484
+ /**
485
+ * Update an image gif
486
+ */
487
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
488
+ /**
489
+ * Set image alignment
490
+ */
491
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
478
492
  };
479
493
  }
480
494
  }
@@ -497,8 +511,9 @@ declare module '@tiptap/core' {
497
511
 
498
512
  declare module '@tiptap/core' {
499
513
  interface Commands<ReturnType> {
500
- attachment: {
501
- setAttachment: (attrs?: unknown) => ReturnType;
514
+ drawer: {
515
+ setDrawer: (options: any, replace?: any) => ReturnType;
516
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
502
517
  };
503
518
  }
504
519
  }
package/lib/index.d.ts CHANGED
@@ -3,12 +3,16 @@ import { BubbleMenu } from '@tiptap/react';
3
3
  import { default as default_2 } from 'react';
4
4
  import { Editor } from '@tiptap/react';
5
5
  import { Editor as Editor_2 } from '@tiptap/core';
6
+ import { EditorState } from '@tiptap/pm/state';
7
+ import { EditorView } from '@tiptap/pm/view';
6
8
  import { ForwardRefExoticComponent } from 'react';
7
9
  import { RefAttributes } from 'react';
8
10
  import { TooltipContentProps } from '@radix-ui/react-tooltip';
9
11
  import { UseEditorOptions } from '@tiptap/react';
10
12
 
11
- declare interface ActionButtonProps {
13
+ export declare const ActionButton: default_2.ForwardRefExoticComponent<Partial<ActionButtonProps> & default_2.RefAttributes<HTMLButtonElement>>;
14
+
15
+ export declare interface ActionButtonProps {
12
16
  icon?: string;
13
17
  title?: string;
14
18
  tooltip?: string;
@@ -73,6 +77,8 @@ declare interface BubbleMenuProps {
73
77
  */
74
78
  hidden?: boolean;
75
79
  items?: string[];
80
+ filterItem?: (item: any, editor: Editor) => boolean;
81
+ showShow?: (props: ShouldShowProps) => boolean;
76
82
  };
77
83
  imageConfig?: {
78
84
  /**
@@ -219,6 +225,15 @@ declare interface RichTextEditorProps {
219
225
  resetCSS?: boolean;
220
226
  }
221
227
 
228
+ declare interface ShouldShowProps {
229
+ editor: Editor;
230
+ view: EditorView;
231
+ state?: EditorState;
232
+ oldState?: EditorState;
233
+ from?: number;
234
+ to?: number;
235
+ }
236
+
222
237
  /**
223
238
  * Represents the ToolbarItemProps.
224
239
  */
@@ -275,17 +290,19 @@ declare module '@tiptap/core' {
275
290
 
276
291
  declare module '@tiptap/core' {
277
292
  interface Commands<ReturnType> {
278
- fontSize: {
293
+ imageUpload: {
279
294
  /**
280
- * Set the text font size. ex: "12px", "2em", or "small". Must be a valid
281
- * CSS font-size
282
- * (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size).
295
+ * Add an image
283
296
  */
284
- setFontSize: (fontSize: string) => ReturnType;
297
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
285
298
  /**
286
- * Unset the font size
299
+ * Update an image
287
300
  */
288
- unsetFontSize: () => ReturnType;
301
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
302
+ /**
303
+ * Set image alignment
304
+ */
305
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
289
306
  };
290
307
  }
291
308
  }
@@ -293,9 +310,14 @@ declare module '@tiptap/core' {
293
310
 
294
311
  declare module '@tiptap/core' {
295
312
  interface Commands<ReturnType> {
296
- lineHeight: {
297
- setLineHeight: (lineHeight: string) => ReturnType;
298
- unsetLineHeight: () => ReturnType;
313
+ iframe: {
314
+ /**
315
+ * Add an iframe
316
+ */
317
+ setIframe: (options: {
318
+ src: string;
319
+ service: string;
320
+ }) => ReturnType;
299
321
  };
300
322
  }
301
323
  }
@@ -303,19 +325,15 @@ declare module '@tiptap/core' {
303
325
 
304
326
  declare module '@tiptap/core' {
305
327
  interface Commands<ReturnType> {
306
- imageUpload: {
307
- /**
308
- * Add an image
309
- */
310
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
328
+ indent: {
311
329
  /**
312
- * Update an image
330
+ * Set the indent attribute
313
331
  */
314
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
332
+ indent: () => ReturnType;
315
333
  /**
316
- * Set image alignment
334
+ * Set the outdent attribute
317
335
  */
318
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
336
+ outdent: () => ReturnType;
319
337
  };
320
338
  }
321
339
  }
@@ -323,13 +341,9 @@ declare module '@tiptap/core' {
323
341
 
324
342
  declare module '@tiptap/core' {
325
343
  interface Commands<ReturnType> {
326
- columns: {
327
- insertColumns: (attrs?: {
328
- cols: number;
329
- }) => ReturnType;
330
- addColBefore: () => ReturnType;
331
- addColAfter: () => ReturnType;
332
- deleteCol: () => ReturnType;
344
+ lineHeight: {
345
+ setLineHeight: (lineHeight: string) => ReturnType;
346
+ unsetLineHeight: () => ReturnType;
333
347
  };
334
348
  }
335
349
  }
@@ -337,8 +351,11 @@ declare module '@tiptap/core' {
337
351
 
338
352
  declare module '@tiptap/core' {
339
353
  interface Commands<ReturnType> {
340
- painter: {
341
- setPainter: (marks: Mark[]) => ReturnType;
354
+ emoji: {
355
+ setEmoji: (emoji: {
356
+ name: string;
357
+ emoji: string;
358
+ }) => ReturnType;
342
359
  };
343
360
  }
344
361
  }
@@ -346,15 +363,17 @@ declare module '@tiptap/core' {
346
363
 
347
364
  declare module '@tiptap/core' {
348
365
  interface Commands<ReturnType> {
349
- indent: {
366
+ fontSize: {
350
367
  /**
351
- * Set the indent attribute
368
+ * Set the text font size. ex: "12px", "2em", or "small". Must be a valid
369
+ * CSS font-size
370
+ * (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size).
352
371
  */
353
- indent: () => ReturnType;
372
+ setFontSize: (fontSize: string) => ReturnType;
354
373
  /**
355
- * Set the outdent attribute
374
+ * Unset the font size
356
375
  */
357
- outdent: () => ReturnType;
376
+ unsetFontSize: () => ReturnType;
358
377
  };
359
378
  }
360
379
  }
@@ -372,14 +391,9 @@ declare module '@tiptap/core' {
372
391
 
373
392
  declare module '@tiptap/core' {
374
393
  interface Commands<ReturnType> {
375
- search: {
376
- setSearchTerm: (searchTerm: string) => ReturnType;
377
- setReplaceTerm: (replaceTerm: string) => ReturnType;
378
- replace: () => ReturnType;
379
- replaceAll: () => ReturnType;
380
- goToPrevSearchResult: () => void;
381
- goToNextSearchResult: () => void;
382
- setCaseSensitive: (caseSensitive: boolean) => ReturnType;
394
+ tableOfContents: {
395
+ setTableOfContents: () => ReturnType;
396
+ removeTableOfContents: () => ReturnType;
383
397
  };
384
398
  }
385
399
  }
@@ -387,9 +401,8 @@ declare module '@tiptap/core' {
387
401
 
388
402
  declare module '@tiptap/core' {
389
403
  interface Commands<ReturnType> {
390
- tableOfContents: {
391
- setTableOfContents: () => ReturnType;
392
- removeTableOfContents: () => ReturnType;
404
+ exportWord: {
405
+ exportToWord: () => ReturnType;
393
406
  };
394
407
  }
395
408
  }
@@ -397,8 +410,8 @@ declare module '@tiptap/core' {
397
410
 
398
411
  declare module '@tiptap/core' {
399
412
  interface Commands<ReturnType> {
400
- exportWord: {
401
- exportToWord: () => ReturnType;
413
+ painter: {
414
+ setPainter: (marks: Mark[]) => ReturnType;
402
415
  };
403
416
  }
404
417
  }
@@ -406,14 +419,14 @@ declare module '@tiptap/core' {
406
419
 
407
420
  declare module '@tiptap/core' {
408
421
  interface Commands<ReturnType> {
409
- iframe: {
410
- /**
411
- * Add an iframe
412
- */
413
- setIframe: (options: {
414
- src: string;
415
- service: string;
416
- }) => ReturnType;
422
+ search: {
423
+ setSearchTerm: (searchTerm: string) => ReturnType;
424
+ setReplaceTerm: (replaceTerm: string) => ReturnType;
425
+ replace: () => ReturnType;
426
+ replaceAll: () => ReturnType;
427
+ goToPrevSearchResult: () => void;
428
+ goToNextSearchResult: () => void;
429
+ setCaseSensitive: (caseSensitive: boolean) => ReturnType;
417
430
  };
418
431
  }
419
432
  }
@@ -421,19 +434,13 @@ declare module '@tiptap/core' {
421
434
 
422
435
  declare module '@tiptap/core' {
423
436
  interface Commands<ReturnType> {
424
- imageGifUpload: {
425
- /**
426
- * Add an image gif
427
- */
428
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
429
- /**
430
- * Update an image gif
431
- */
432
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
433
- /**
434
- * Set image alignment
435
- */
436
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
437
+ columns: {
438
+ insertColumns: (attrs?: {
439
+ cols: number;
440
+ }) => ReturnType;
441
+ addColBefore: () => ReturnType;
442
+ addColAfter: () => ReturnType;
443
+ deleteCol: () => ReturnType;
437
444
  };
438
445
  }
439
446
  }
@@ -460,9 +467,8 @@ declare module '@tiptap/core' {
460
467
 
461
468
  declare module '@tiptap/core' {
462
469
  interface Commands<ReturnType> {
463
- drawer: {
464
- setDrawer: (options: any, replace?: any) => ReturnType;
465
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
470
+ attachment: {
471
+ setAttachment: (attrs?: unknown) => ReturnType;
466
472
  };
467
473
  }
468
474
  }
@@ -470,11 +476,19 @@ declare module '@tiptap/core' {
470
476
 
471
477
  declare module '@tiptap/core' {
472
478
  interface Commands<ReturnType> {
473
- emoji: {
474
- setEmoji: (emoji: {
475
- name: string;
476
- emoji: string;
477
- }) => ReturnType;
479
+ imageGifUpload: {
480
+ /**
481
+ * Add an image gif
482
+ */
483
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
484
+ /**
485
+ * Update an image gif
486
+ */
487
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
488
+ /**
489
+ * Set image alignment
490
+ */
491
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
478
492
  };
479
493
  }
480
494
  }
@@ -497,8 +511,9 @@ declare module '@tiptap/core' {
497
511
 
498
512
  declare module '@tiptap/core' {
499
513
  interface Commands<ReturnType> {
500
- attachment: {
501
- setAttachment: (attrs?: unknown) => ReturnType;
514
+ drawer: {
515
+ setDrawer: (options: any, replace?: any) => ReturnType;
516
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
502
517
  };
503
518
  }
504
519
  }