reactjs-tiptap-editor 0.2.19 → 0.2.21

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.
@@ -10,7 +10,9 @@ import { ColorOptions as ColorOptions_2 } from '@tiptap/extension-color';
10
10
  import { default as default_2 } from 'mammoth';
11
11
  import { DropcursorOptions } from '@tiptap/extension-dropcursor';
12
12
  import { Editor } from '@tiptap/react';
13
+ import { Editor as Editor_2 } from '@tiptap/core';
13
14
  import { Extension } from '@tiptap/core';
15
+ import { Extensions } from '@tiptap/core';
14
16
  import { FocusOptions as FocusOptions_2 } from '@tiptap/extension-focus';
15
17
  import { FontFamilyOptions as FontFamilyOptions_2 } from '@tiptap/extension-font-family';
16
18
  import { HardBreakOptions } from '@tiptap/extension-hard-break';
@@ -29,6 +31,7 @@ import { Node as Node_2 } from '@tiptap/core';
29
31
  import { OrderedListOptions as OrderedListOptions_2 } from '@tiptap/extension-ordered-list';
30
32
  import { ParagraphOptions } from '@tiptap/extension-paragraph';
31
33
  import { PlaceholderOptions } from '@tiptap/extension-placeholder';
34
+ import { Range as Range_2 } from '@tiptap/core';
32
35
  import { StrikeOptions as StrikeOptions_2 } from '@tiptap/extension-strike';
33
36
  import { SubscriptExtensionOptions } from '@tiptap/extension-subscript';
34
37
  import { SuperscriptExtensionOptions } from '@tiptap/extension-superscript';
@@ -259,6 +262,20 @@ export declare const Column: Node_2<any, any>;
259
262
 
260
263
  export declare const ColumnActionButton: Extension<any, any>;
261
264
 
265
+ declare interface Command {
266
+ name: string;
267
+ label: string;
268
+ description?: string;
269
+ aliases?: string[];
270
+ iconName?: any;
271
+ iconUrl?: string;
272
+ action: ({ editor, range }: {
273
+ editor: Editor_2;
274
+ range: Range_2;
275
+ }) => void;
276
+ shouldBeHidden?: (editor: Editor_2) => boolean;
277
+ }
278
+
262
279
  export declare const Drawer: Node_2<DrawerOptions, any>;
263
280
 
264
281
  declare interface DrawerOptions extends GeneralOptions<DrawerOptions> {
@@ -326,6 +343,12 @@ declare interface GeneralOptions<T> {
326
343
  toolbar?: boolean;
327
344
  }
328
345
 
346
+ declare interface Group {
347
+ name: string;
348
+ title: string;
349
+ commands: Command[];
350
+ }
351
+
329
352
  export declare const Heading: Node_2<HeadingOptions, any>;
330
353
 
331
354
  export declare interface HeadingOptions extends HeadingOptions_2, GeneralOptions<HeadingOptions> {
@@ -503,7 +526,11 @@ export declare interface SetImageAttrsOptions {
503
526
  flipY?: boolean;
504
527
  }
505
528
 
506
- export declare const SlashCommand: Extension<any, any>;
529
+ export declare const SlashCommand: Extension<SlashCommandOptions, any>;
530
+
531
+ declare interface SlashCommandOptions {
532
+ renderGroupItem?: (extension: Extensions[number], groups: Group[]) => void;
533
+ }
507
534
 
508
535
  export declare const Strike: Mark<StrikeOptions, any>;
509
536
 
@@ -714,6 +741,21 @@ declare module '@tiptap/core' {
714
741
  }
715
742
 
716
743
 
744
+ declare module '@tiptap/core' {
745
+ interface Commands<ReturnType> {
746
+ iframe: {
747
+ /**
748
+ * Add an iframe
749
+ */
750
+ setIframe: (options: {
751
+ src: string;
752
+ service: string;
753
+ }) => ReturnType;
754
+ };
755
+ }
756
+ }
757
+
758
+
717
759
  declare module '@tiptap/core' {
718
760
  interface Commands<ReturnType> {
719
761
  lineHeight: {
@@ -763,35 +805,6 @@ declare module '@tiptap/core' {
763
805
  }
764
806
 
765
807
 
766
- declare module '@tiptap/core' {
767
- interface Commands<ReturnType> {
768
- columns: {
769
- insertColumns: (attrs?: {
770
- cols: number;
771
- }) => ReturnType;
772
- addColBefore: () => ReturnType;
773
- addColAfter: () => ReturnType;
774
- deleteCol: () => ReturnType;
775
- };
776
- }
777
- }
778
-
779
-
780
- declare module '@tiptap/core' {
781
- interface Commands<ReturnType> {
782
- iframe: {
783
- /**
784
- * Add an iframe
785
- */
786
- setIframe: (options: {
787
- src: string;
788
- service: string;
789
- }) => ReturnType;
790
- };
791
- }
792
- }
793
-
794
-
795
808
  declare module '@tiptap/core' {
796
809
  interface Commands<ReturnType> {
797
810
  search: {
@@ -819,6 +832,20 @@ declare module '@tiptap/core' {
819
832
  }
820
833
 
821
834
 
835
+ declare module '@tiptap/core' {
836
+ interface Commands<ReturnType> {
837
+ columns: {
838
+ insertColumns: (attrs?: {
839
+ cols: number;
840
+ }) => ReturnType;
841
+ addColBefore: () => ReturnType;
842
+ addColAfter: () => ReturnType;
843
+ deleteCol: () => ReturnType;
844
+ };
845
+ }
846
+ }
847
+
848
+
822
849
  declare module '@tiptap/core' {
823
850
  interface Commands<ReturnType> {
824
851
  katex: {
@@ -839,9 +866,8 @@ declare module '@tiptap/core' {
839
866
 
840
867
  declare module '@tiptap/core' {
841
868
  interface Commands<ReturnType> {
842
- tableOfContents: {
843
- setTableOfContents: () => ReturnType;
844
- removeTableOfContents: () => ReturnType;
869
+ excalidraw: {
870
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
845
871
  };
846
872
  }
847
873
  }
@@ -849,8 +875,9 @@ declare module '@tiptap/core' {
849
875
 
850
876
  declare module '@tiptap/core' {
851
877
  interface Commands<ReturnType> {
852
- attachment: {
853
- setAttachment: (attrs?: unknown) => ReturnType;
878
+ tableOfContents: {
879
+ setTableOfContents: () => ReturnType;
880
+ removeTableOfContents: () => ReturnType;
854
881
  };
855
882
  }
856
883
  }
@@ -858,9 +885,8 @@ declare module '@tiptap/core' {
858
885
 
859
886
  declare module '@tiptap/core' {
860
887
  interface Commands<ReturnType> {
861
- drawer: {
862
- setDrawer: (options: any, replace?: any) => ReturnType;
863
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
888
+ attachment: {
889
+ setAttachment: (attrs?: unknown) => ReturnType;
864
890
  };
865
891
  }
866
892
  }
@@ -868,8 +894,19 @@ declare module '@tiptap/core' {
868
894
 
869
895
  declare module '@tiptap/core' {
870
896
  interface Commands<ReturnType> {
871
- excalidraw: {
872
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
897
+ imageGifUpload: {
898
+ /**
899
+ * Add an image gif
900
+ */
901
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
902
+ /**
903
+ * Update an image gif
904
+ */
905
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
906
+ /**
907
+ * Set image alignment
908
+ */
909
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
873
910
  };
874
911
  }
875
912
  }
@@ -892,9 +929,9 @@ declare module '@tiptap/core' {
892
929
 
893
930
  declare module '@tiptap/core' {
894
931
  interface Commands<ReturnType> {
895
- mermaid: {
896
- setMermaid: (options: any, replace?: any) => ReturnType;
897
- setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
932
+ drawer: {
933
+ setDrawer: (options: any, replace?: any) => ReturnType;
934
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
898
935
  };
899
936
  }
900
937
  }
@@ -902,19 +939,9 @@ declare module '@tiptap/core' {
902
939
 
903
940
  declare module '@tiptap/core' {
904
941
  interface Commands<ReturnType> {
905
- imageGifUpload: {
906
- /**
907
- * Add an image gif
908
- */
909
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
910
- /**
911
- * Update an image gif
912
- */
913
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
914
- /**
915
- * Set image alignment
916
- */
917
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
942
+ mermaid: {
943
+ setMermaid: (options: any, replace?: any) => ReturnType;
944
+ setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
918
945
  };
919
946
  }
920
947
  }
@@ -10,7 +10,9 @@ import { ColorOptions as ColorOptions_2 } from '@tiptap/extension-color';
10
10
  import { default as default_2 } from 'mammoth';
11
11
  import { DropcursorOptions } from '@tiptap/extension-dropcursor';
12
12
  import { Editor } from '@tiptap/react';
13
+ import { Editor as Editor_2 } from '@tiptap/core';
13
14
  import { Extension } from '@tiptap/core';
15
+ import { Extensions } from '@tiptap/core';
14
16
  import { FocusOptions as FocusOptions_2 } from '@tiptap/extension-focus';
15
17
  import { FontFamilyOptions as FontFamilyOptions_2 } from '@tiptap/extension-font-family';
16
18
  import { HardBreakOptions } from '@tiptap/extension-hard-break';
@@ -29,6 +31,7 @@ import { Node as Node_2 } from '@tiptap/core';
29
31
  import { OrderedListOptions as OrderedListOptions_2 } from '@tiptap/extension-ordered-list';
30
32
  import { ParagraphOptions } from '@tiptap/extension-paragraph';
31
33
  import { PlaceholderOptions } from '@tiptap/extension-placeholder';
34
+ import { Range as Range_2 } from '@tiptap/core';
32
35
  import { StrikeOptions as StrikeOptions_2 } from '@tiptap/extension-strike';
33
36
  import { SubscriptExtensionOptions } from '@tiptap/extension-subscript';
34
37
  import { SuperscriptExtensionOptions } from '@tiptap/extension-superscript';
@@ -259,6 +262,20 @@ export declare const Column: Node_2<any, any>;
259
262
 
260
263
  export declare const ColumnActionButton: Extension<any, any>;
261
264
 
265
+ declare interface Command {
266
+ name: string;
267
+ label: string;
268
+ description?: string;
269
+ aliases?: string[];
270
+ iconName?: any;
271
+ iconUrl?: string;
272
+ action: ({ editor, range }: {
273
+ editor: Editor_2;
274
+ range: Range_2;
275
+ }) => void;
276
+ shouldBeHidden?: (editor: Editor_2) => boolean;
277
+ }
278
+
262
279
  export declare const Drawer: Node_2<DrawerOptions, any>;
263
280
 
264
281
  declare interface DrawerOptions extends GeneralOptions<DrawerOptions> {
@@ -326,6 +343,12 @@ declare interface GeneralOptions<T> {
326
343
  toolbar?: boolean;
327
344
  }
328
345
 
346
+ declare interface Group {
347
+ name: string;
348
+ title: string;
349
+ commands: Command[];
350
+ }
351
+
329
352
  export declare const Heading: Node_2<HeadingOptions, any>;
330
353
 
331
354
  export declare interface HeadingOptions extends HeadingOptions_2, GeneralOptions<HeadingOptions> {
@@ -503,7 +526,11 @@ export declare interface SetImageAttrsOptions {
503
526
  flipY?: boolean;
504
527
  }
505
528
 
506
- export declare const SlashCommand: Extension<any, any>;
529
+ export declare const SlashCommand: Extension<SlashCommandOptions, any>;
530
+
531
+ declare interface SlashCommandOptions {
532
+ renderGroupItem?: (extension: Extensions[number], groups: Group[]) => void;
533
+ }
507
534
 
508
535
  export declare const Strike: Mark<StrikeOptions, any>;
509
536
 
@@ -714,6 +741,21 @@ declare module '@tiptap/core' {
714
741
  }
715
742
 
716
743
 
744
+ declare module '@tiptap/core' {
745
+ interface Commands<ReturnType> {
746
+ iframe: {
747
+ /**
748
+ * Add an iframe
749
+ */
750
+ setIframe: (options: {
751
+ src: string;
752
+ service: string;
753
+ }) => ReturnType;
754
+ };
755
+ }
756
+ }
757
+
758
+
717
759
  declare module '@tiptap/core' {
718
760
  interface Commands<ReturnType> {
719
761
  lineHeight: {
@@ -763,35 +805,6 @@ declare module '@tiptap/core' {
763
805
  }
764
806
 
765
807
 
766
- declare module '@tiptap/core' {
767
- interface Commands<ReturnType> {
768
- columns: {
769
- insertColumns: (attrs?: {
770
- cols: number;
771
- }) => ReturnType;
772
- addColBefore: () => ReturnType;
773
- addColAfter: () => ReturnType;
774
- deleteCol: () => ReturnType;
775
- };
776
- }
777
- }
778
-
779
-
780
- declare module '@tiptap/core' {
781
- interface Commands<ReturnType> {
782
- iframe: {
783
- /**
784
- * Add an iframe
785
- */
786
- setIframe: (options: {
787
- src: string;
788
- service: string;
789
- }) => ReturnType;
790
- };
791
- }
792
- }
793
-
794
-
795
808
  declare module '@tiptap/core' {
796
809
  interface Commands<ReturnType> {
797
810
  search: {
@@ -819,6 +832,20 @@ declare module '@tiptap/core' {
819
832
  }
820
833
 
821
834
 
835
+ declare module '@tiptap/core' {
836
+ interface Commands<ReturnType> {
837
+ columns: {
838
+ insertColumns: (attrs?: {
839
+ cols: number;
840
+ }) => ReturnType;
841
+ addColBefore: () => ReturnType;
842
+ addColAfter: () => ReturnType;
843
+ deleteCol: () => ReturnType;
844
+ };
845
+ }
846
+ }
847
+
848
+
822
849
  declare module '@tiptap/core' {
823
850
  interface Commands<ReturnType> {
824
851
  katex: {
@@ -839,9 +866,8 @@ declare module '@tiptap/core' {
839
866
 
840
867
  declare module '@tiptap/core' {
841
868
  interface Commands<ReturnType> {
842
- tableOfContents: {
843
- setTableOfContents: () => ReturnType;
844
- removeTableOfContents: () => ReturnType;
869
+ excalidraw: {
870
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
845
871
  };
846
872
  }
847
873
  }
@@ -849,8 +875,9 @@ declare module '@tiptap/core' {
849
875
 
850
876
  declare module '@tiptap/core' {
851
877
  interface Commands<ReturnType> {
852
- attachment: {
853
- setAttachment: (attrs?: unknown) => ReturnType;
878
+ tableOfContents: {
879
+ setTableOfContents: () => ReturnType;
880
+ removeTableOfContents: () => ReturnType;
854
881
  };
855
882
  }
856
883
  }
@@ -858,9 +885,8 @@ declare module '@tiptap/core' {
858
885
 
859
886
  declare module '@tiptap/core' {
860
887
  interface Commands<ReturnType> {
861
- drawer: {
862
- setDrawer: (options: any, replace?: any) => ReturnType;
863
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
888
+ attachment: {
889
+ setAttachment: (attrs?: unknown) => ReturnType;
864
890
  };
865
891
  }
866
892
  }
@@ -868,8 +894,19 @@ declare module '@tiptap/core' {
868
894
 
869
895
  declare module '@tiptap/core' {
870
896
  interface Commands<ReturnType> {
871
- excalidraw: {
872
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
897
+ imageGifUpload: {
898
+ /**
899
+ * Add an image gif
900
+ */
901
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
902
+ /**
903
+ * Update an image gif
904
+ */
905
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
906
+ /**
907
+ * Set image alignment
908
+ */
909
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
873
910
  };
874
911
  }
875
912
  }
@@ -892,9 +929,9 @@ declare module '@tiptap/core' {
892
929
 
893
930
  declare module '@tiptap/core' {
894
931
  interface Commands<ReturnType> {
895
- mermaid: {
896
- setMermaid: (options: any, replace?: any) => ReturnType;
897
- setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
932
+ drawer: {
933
+ setDrawer: (options: any, replace?: any) => ReturnType;
934
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
898
935
  };
899
936
  }
900
937
  }
@@ -902,19 +939,9 @@ declare module '@tiptap/core' {
902
939
 
903
940
  declare module '@tiptap/core' {
904
941
  interface Commands<ReturnType> {
905
- imageGifUpload: {
906
- /**
907
- * Add an image gif
908
- */
909
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
910
- /**
911
- * Update an image gif
912
- */
913
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
914
- /**
915
- * Set image alignment
916
- */
917
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
942
+ mermaid: {
943
+ setMermaid: (options: any, replace?: any) => ReturnType;
944
+ setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
918
945
  };
919
946
  }
920
947
  }