reactjs-tiptap-editor 0.2.21 → 0.2.24

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.ts CHANGED
@@ -1,13 +1,44 @@
1
1
  import { AnyExtension } from '@tiptap/core';
2
2
  import { BubbleMenu } from '@tiptap/react';
3
+ import { default as default_2 } from 'react';
3
4
  import { Editor } from '@tiptap/react';
4
5
  import { Editor as Editor_2 } from '@tiptap/core';
5
6
  import { ForwardRefExoticComponent } from 'react';
6
7
  import { RefAttributes } from 'react';
8
+ import { TooltipContentProps } from '@radix-ui/react-tooltip';
7
9
  import { UseEditorOptions } from '@tiptap/react';
8
10
 
11
+ declare interface ActionButtonProps {
12
+ icon?: string;
13
+ title?: string;
14
+ tooltip?: string;
15
+ disabled?: boolean;
16
+ shortcutKeys?: string[];
17
+ customClass?: string;
18
+ loading?: boolean;
19
+ tooltipOptions?: TooltipContentProps;
20
+ color?: string;
21
+ action?: ButtonViewReturnComponentProps['action'];
22
+ isActive?: ButtonViewReturnComponentProps['isActive'];
23
+ children?: default_2.ReactNode;
24
+ asChild?: boolean;
25
+ upload?: boolean;
26
+ }
27
+
9
28
  export { BubbleMenu }
10
29
 
30
+ declare interface BubbleMenuConfig {
31
+ /**
32
+ * @description Column menu hidden
33
+ * @default false
34
+ */
35
+ hidden?: boolean;
36
+ /**
37
+ * custom menu actions
38
+ */
39
+ actions?: ActionButtonProps[];
40
+ }
41
+
11
42
  /**
12
43
  * Represents the BubbleMenuProps.
13
44
  */
@@ -19,13 +50,7 @@ declare interface BubbleMenuProps {
19
50
  */
20
51
  hidden?: boolean;
21
52
  };
22
- tableConfig?: {
23
- /**
24
- * @description Table menu hidden
25
- * @default false
26
- */
27
- hidden?: boolean;
28
- };
53
+ tableConfig?: BubbleMenuConfig;
29
54
  floatingMenuConfig?: {
30
55
  /**
31
56
  * @description Floating menu hidden
@@ -122,6 +147,21 @@ declare interface BubbleMenuRenderProps {
122
147
  bubbleMenu: BubbleMenuProps;
123
148
  }
124
149
 
150
+ /**
151
+ * Represents the props for the ButtonView component.
152
+ */
153
+ declare interface ButtonViewReturnComponentProps {
154
+ /** Method triggered when action is performed */
155
+ action?: (value?: any) => void;
156
+ /** Whether it is in the active state */
157
+ isActive?: () => boolean;
158
+ /** Button icon */
159
+ icon?: any;
160
+ /** Text displayed on hover */
161
+ tooltip?: string;
162
+ [x: string]: any;
163
+ }
164
+
125
165
  declare const _default: ForwardRefExoticComponent<RichTextEditorProps & RefAttributes< {
126
166
  editor: Editor_2 | null;
127
167
  }>>;
@@ -231,6 +271,15 @@ declare module '@tiptap/core' {
231
271
  }
232
272
 
233
273
 
274
+ declare module '@tiptap/core' {
275
+ interface Commands<ReturnType> {
276
+ setCodeBlock: {
277
+ setCodeBlock: (options?: any) => ReturnType;
278
+ };
279
+ }
280
+ }
281
+
282
+
234
283
  declare module '@tiptap/core' {
235
284
  interface Commands<ReturnType> {
236
285
  fontSize: {
@@ -251,15 +300,19 @@ declare module '@tiptap/core' {
251
300
 
252
301
  declare module '@tiptap/core' {
253
302
  interface Commands<ReturnType> {
254
- indent: {
303
+ imageUpload: {
255
304
  /**
256
- * Set the indent attribute
305
+ * Add an image
257
306
  */
258
- indent: () => ReturnType;
307
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
259
308
  /**
260
- * Set the outdent attribute
309
+ * Update an image
261
310
  */
262
- outdent: () => ReturnType;
311
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
312
+ /**
313
+ * Set image alignment
314
+ */
315
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
263
316
  };
264
317
  }
265
318
  }
@@ -267,14 +320,15 @@ declare module '@tiptap/core' {
267
320
 
268
321
  declare module '@tiptap/core' {
269
322
  interface Commands<ReturnType> {
270
- iframe: {
323
+ indent: {
271
324
  /**
272
- * Add an iframe
325
+ * Set the indent attribute
273
326
  */
274
- setIframe: (options: {
275
- src: string;
276
- service: string;
277
- }) => ReturnType;
327
+ indent: () => ReturnType;
328
+ /**
329
+ * Set the outdent attribute
330
+ */
331
+ outdent: () => ReturnType;
278
332
  };
279
333
  }
280
334
  }
@@ -290,26 +344,6 @@ declare module '@tiptap/core' {
290
344
  }
291
345
 
292
346
 
293
- declare module '@tiptap/core' {
294
- interface Commands<ReturnType> {
295
- imageUpload: {
296
- /**
297
- * Add an image
298
- */
299
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
300
- /**
301
- * Update an image
302
- */
303
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
304
- /**
305
- * Set image alignment
306
- */
307
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
308
- };
309
- }
310
- }
311
-
312
-
313
347
  declare module '@tiptap/core' {
314
348
  interface Commands<ReturnType> {
315
349
  tableCellBackground: {
@@ -329,33 +363,6 @@ declare module '@tiptap/core' {
329
363
  }
330
364
 
331
365
 
332
- declare module '@tiptap/core' {
333
- interface Commands<ReturnType> {
334
- search: {
335
- setSearchTerm: (searchTerm: string) => ReturnType;
336
- setReplaceTerm: (replaceTerm: string) => ReturnType;
337
- replace: () => ReturnType;
338
- replaceAll: () => ReturnType;
339
- goToPrevSearchResult: () => void;
340
- goToNextSearchResult: () => void;
341
- setCaseSensitive: (caseSensitive: boolean) => ReturnType;
342
- };
343
- }
344
- }
345
-
346
-
347
- declare module '@tiptap/core' {
348
- interface Commands<ReturnType> {
349
- emoji: {
350
- setEmoji: (emoji: {
351
- name: string;
352
- emoji: string;
353
- }) => ReturnType;
354
- };
355
- }
356
- }
357
-
358
-
359
366
  declare module '@tiptap/core' {
360
367
  interface Commands<ReturnType> {
361
368
  columns: {
@@ -372,8 +379,14 @@ declare module '@tiptap/core' {
372
379
 
373
380
  declare module '@tiptap/core' {
374
381
  interface Commands<ReturnType> {
375
- katex: {
376
- setKatex: (arg?: IKatexAttrs) => ReturnType;
382
+ iframe: {
383
+ /**
384
+ * Add an iframe
385
+ */
386
+ setIframe: (options: {
387
+ src: string;
388
+ service: string;
389
+ }) => ReturnType;
377
390
  };
378
391
  }
379
392
  }
@@ -381,8 +394,11 @@ declare module '@tiptap/core' {
381
394
 
382
395
  declare module '@tiptap/core' {
383
396
  interface Commands<ReturnType> {
384
- exportWord: {
385
- exportToWord: () => ReturnType;
397
+ emoji: {
398
+ setEmoji: (emoji: {
399
+ name: string;
400
+ emoji: string;
401
+ }) => ReturnType;
386
402
  };
387
403
  }
388
404
  }
@@ -390,8 +406,14 @@ declare module '@tiptap/core' {
390
406
 
391
407
  declare module '@tiptap/core' {
392
408
  interface Commands<ReturnType> {
393
- excalidraw: {
394
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
409
+ search: {
410
+ setSearchTerm: (searchTerm: string) => ReturnType;
411
+ setReplaceTerm: (replaceTerm: string) => ReturnType;
412
+ replace: () => ReturnType;
413
+ replaceAll: () => ReturnType;
414
+ goToPrevSearchResult: () => void;
415
+ goToNextSearchResult: () => void;
416
+ setCaseSensitive: (caseSensitive: boolean) => ReturnType;
395
417
  };
396
418
  }
397
419
  }
@@ -409,8 +431,17 @@ declare module '@tiptap/core' {
409
431
 
410
432
  declare module '@tiptap/core' {
411
433
  interface Commands<ReturnType> {
412
- attachment: {
413
- setAttachment: (attrs?: unknown) => ReturnType;
434
+ katex: {
435
+ setKatex: (arg?: IKatexAttrs) => ReturnType;
436
+ };
437
+ }
438
+ }
439
+
440
+
441
+ declare module '@tiptap/core' {
442
+ interface Commands<ReturnType> {
443
+ exportWord: {
444
+ exportToWord: () => ReturnType;
414
445
  };
415
446
  }
416
447
  }
@@ -438,14 +469,27 @@ declare module '@tiptap/core' {
438
469
 
439
470
  declare module '@tiptap/core' {
440
471
  interface Commands<ReturnType> {
441
- twitter: {
442
- /**
443
- * Insert a tweet
444
- * @param options The tweet attributes
445
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
446
- */
447
- setTweet: (options: SetTweetOptions) => ReturnType;
448
- updateTweet: (options: SetTweetOptions) => ReturnType;
472
+ mermaid: {
473
+ setMermaid: (options: any, replace?: any) => ReturnType;
474
+ setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
475
+ };
476
+ }
477
+ }
478
+
479
+
480
+ declare module '@tiptap/core' {
481
+ interface Commands<ReturnType> {
482
+ attachment: {
483
+ setAttachment: (attrs?: unknown) => ReturnType;
484
+ };
485
+ }
486
+ }
487
+
488
+
489
+ declare module '@tiptap/core' {
490
+ interface Commands<ReturnType> {
491
+ excalidraw: {
492
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
449
493
  };
450
494
  }
451
495
  }
@@ -463,9 +507,14 @@ declare module '@tiptap/core' {
463
507
 
464
508
  declare module '@tiptap/core' {
465
509
  interface Commands<ReturnType> {
466
- mermaid: {
467
- setMermaid: (options: any, replace?: any) => ReturnType;
468
- setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
510
+ twitter: {
511
+ /**
512
+ * Insert a tweet
513
+ * @param options The tweet attributes
514
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
515
+ */
516
+ setTweet: (options: SetTweetOptions) => ReturnType;
517
+ updateTweet: (options: SetTweetOptions) => ReturnType;
469
518
  };
470
519
  }
471
520
  }
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useRef as d, useState as o, useEffect as f } from "react";
2
- import { R as m } from "./RichTextEditor-aaUynZc2.js";
3
- import { B as x } from "./tiptap-BV9BUpUC.js";
2
+ import { R as m } from "./RichTextEditor-C_dIT2FZ.js";
3
+ import { B as x } from "./tiptap-CXio79KB.js";
4
4
  function c() {
5
5
  var t;
6
6
  const e = d({ editor: null }), [u, s] = o(!1), [i, n] = o(null);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CYg22iLG.cjs");exports.en=e.locale$1;exports.hu_HU=e.locale$2;exports.locale=e.locale;exports.pt_BR=e.locale$5;exports.vi=e.locale$3;exports.zh_CN=e.locale$4;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CJ6Hb9MN.cjs");exports.en=e.locale$1;exports.hu_HU=e.locale$2;exports.locale=e.locale;exports.pt_BR=e.locale$5;exports.vi=e.locale$3;exports.zh_CN=e.locale$4;
@@ -900,6 +900,15 @@ declare module '@tiptap/core' {
900
900
  }
901
901
 
902
902
 
903
+ declare module '@tiptap/core' {
904
+ interface Commands<ReturnType> {
905
+ setCodeBlock: {
906
+ setCodeBlock: (options?: any) => ReturnType;
907
+ };
908
+ }
909
+ }
910
+
911
+
903
912
  declare module '@tiptap/core' {
904
913
  interface Commands<ReturnType> {
905
914
  fontSize: {
@@ -920,15 +929,19 @@ declare module '@tiptap/core' {
920
929
 
921
930
  declare module '@tiptap/core' {
922
931
  interface Commands<ReturnType> {
923
- indent: {
932
+ imageUpload: {
924
933
  /**
925
- * Set the indent attribute
934
+ * Add an image
926
935
  */
927
- indent: () => ReturnType;
936
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
928
937
  /**
929
- * Set the outdent attribute
938
+ * Update an image
930
939
  */
931
- outdent: () => ReturnType;
940
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
941
+ /**
942
+ * Set image alignment
943
+ */
944
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
932
945
  };
933
946
  }
934
947
  }
@@ -936,14 +949,15 @@ declare module '@tiptap/core' {
936
949
 
937
950
  declare module '@tiptap/core' {
938
951
  interface Commands<ReturnType> {
939
- iframe: {
952
+ indent: {
940
953
  /**
941
- * Add an iframe
954
+ * Set the indent attribute
942
955
  */
943
- setIframe: (options: {
944
- src: string;
945
- service: string;
946
- }) => ReturnType;
956
+ indent: () => ReturnType;
957
+ /**
958
+ * Set the outdent attribute
959
+ */
960
+ outdent: () => ReturnType;
947
961
  };
948
962
  }
949
963
  }
@@ -959,26 +973,6 @@ declare module '@tiptap/core' {
959
973
  }
960
974
 
961
975
 
962
- declare module '@tiptap/core' {
963
- interface Commands<ReturnType> {
964
- imageUpload: {
965
- /**
966
- * Add an image
967
- */
968
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
969
- /**
970
- * Update an image
971
- */
972
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
973
- /**
974
- * Set image alignment
975
- */
976
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
977
- };
978
- }
979
- }
980
-
981
-
982
976
  declare module '@tiptap/core' {
983
977
  interface Commands<ReturnType> {
984
978
  tableCellBackground: {
@@ -998,33 +992,6 @@ declare module '@tiptap/core' {
998
992
  }
999
993
 
1000
994
 
1001
- declare module '@tiptap/core' {
1002
- interface Commands<ReturnType> {
1003
- search: {
1004
- setSearchTerm: (searchTerm: string) => ReturnType;
1005
- setReplaceTerm: (replaceTerm: string) => ReturnType;
1006
- replace: () => ReturnType;
1007
- replaceAll: () => ReturnType;
1008
- goToPrevSearchResult: () => void;
1009
- goToNextSearchResult: () => void;
1010
- setCaseSensitive: (caseSensitive: boolean) => ReturnType;
1011
- };
1012
- }
1013
- }
1014
-
1015
-
1016
- declare module '@tiptap/core' {
1017
- interface Commands<ReturnType> {
1018
- emoji: {
1019
- setEmoji: (emoji: {
1020
- name: string;
1021
- emoji: string;
1022
- }) => ReturnType;
1023
- };
1024
- }
1025
- }
1026
-
1027
-
1028
995
  declare module '@tiptap/core' {
1029
996
  interface Commands<ReturnType> {
1030
997
  columns: {
@@ -1041,8 +1008,14 @@ declare module '@tiptap/core' {
1041
1008
 
1042
1009
  declare module '@tiptap/core' {
1043
1010
  interface Commands<ReturnType> {
1044
- katex: {
1045
- setKatex: (arg?: IKatexAttrs) => ReturnType;
1011
+ iframe: {
1012
+ /**
1013
+ * Add an iframe
1014
+ */
1015
+ setIframe: (options: {
1016
+ src: string;
1017
+ service: string;
1018
+ }) => ReturnType;
1046
1019
  };
1047
1020
  }
1048
1021
  }
@@ -1050,8 +1023,11 @@ declare module '@tiptap/core' {
1050
1023
 
1051
1024
  declare module '@tiptap/core' {
1052
1025
  interface Commands<ReturnType> {
1053
- exportWord: {
1054
- exportToWord: () => ReturnType;
1026
+ emoji: {
1027
+ setEmoji: (emoji: {
1028
+ name: string;
1029
+ emoji: string;
1030
+ }) => ReturnType;
1055
1031
  };
1056
1032
  }
1057
1033
  }
@@ -1059,8 +1035,14 @@ declare module '@tiptap/core' {
1059
1035
 
1060
1036
  declare module '@tiptap/core' {
1061
1037
  interface Commands<ReturnType> {
1062
- excalidraw: {
1063
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
1038
+ search: {
1039
+ setSearchTerm: (searchTerm: string) => ReturnType;
1040
+ setReplaceTerm: (replaceTerm: string) => ReturnType;
1041
+ replace: () => ReturnType;
1042
+ replaceAll: () => ReturnType;
1043
+ goToPrevSearchResult: () => void;
1044
+ goToNextSearchResult: () => void;
1045
+ setCaseSensitive: (caseSensitive: boolean) => ReturnType;
1064
1046
  };
1065
1047
  }
1066
1048
  }
@@ -1078,8 +1060,17 @@ declare module '@tiptap/core' {
1078
1060
 
1079
1061
  declare module '@tiptap/core' {
1080
1062
  interface Commands<ReturnType> {
1081
- attachment: {
1082
- setAttachment: (attrs?: unknown) => ReturnType;
1063
+ katex: {
1064
+ setKatex: (arg?: IKatexAttrs) => ReturnType;
1065
+ };
1066
+ }
1067
+ }
1068
+
1069
+
1070
+ declare module '@tiptap/core' {
1071
+ interface Commands<ReturnType> {
1072
+ exportWord: {
1073
+ exportToWord: () => ReturnType;
1083
1074
  };
1084
1075
  }
1085
1076
  }
@@ -1107,14 +1098,27 @@ declare module '@tiptap/core' {
1107
1098
 
1108
1099
  declare module '@tiptap/core' {
1109
1100
  interface Commands<ReturnType> {
1110
- twitter: {
1111
- /**
1112
- * Insert a tweet
1113
- * @param options The tweet attributes
1114
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
1115
- */
1116
- setTweet: (options: SetTweetOptions) => ReturnType;
1117
- updateTweet: (options: SetTweetOptions) => ReturnType;
1101
+ mermaid: {
1102
+ setMermaid: (options: any, replace?: any) => ReturnType;
1103
+ setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
1104
+ };
1105
+ }
1106
+ }
1107
+
1108
+
1109
+ declare module '@tiptap/core' {
1110
+ interface Commands<ReturnType> {
1111
+ attachment: {
1112
+ setAttachment: (attrs?: unknown) => ReturnType;
1113
+ };
1114
+ }
1115
+ }
1116
+
1117
+
1118
+ declare module '@tiptap/core' {
1119
+ interface Commands<ReturnType> {
1120
+ excalidraw: {
1121
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
1118
1122
  };
1119
1123
  }
1120
1124
  }
@@ -1132,9 +1136,14 @@ declare module '@tiptap/core' {
1132
1136
 
1133
1137
  declare module '@tiptap/core' {
1134
1138
  interface Commands<ReturnType> {
1135
- mermaid: {
1136
- setMermaid: (options: any, replace?: any) => ReturnType;
1137
- setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
1139
+ twitter: {
1140
+ /**
1141
+ * Insert a tweet
1142
+ * @param options The tweet attributes
1143
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
1144
+ */
1145
+ setTweet: (options: SetTweetOptions) => ReturnType;
1146
+ updateTweet: (options: SetTweetOptions) => ReturnType;
1138
1147
  };
1139
1148
  }
1140
1149
  }