reactjs-tiptap-editor 0.2.20 → 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
 
@@ -716,9 +743,24 @@ declare module '@tiptap/core' {
716
743
 
717
744
  declare module '@tiptap/core' {
718
745
  interface Commands<ReturnType> {
719
- tableCellBackground: {
720
- setTableCellBackground: (color: string) => ReturnType;
721
- unsetTableCellBackground: () => 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
+
759
+ declare module '@tiptap/core' {
760
+ interface Commands<ReturnType> {
761
+ lineHeight: {
762
+ setLineHeight: (lineHeight: string) => ReturnType;
763
+ unsetLineHeight: () => ReturnType;
722
764
  };
723
765
  }
724
766
  }
@@ -746,8 +788,9 @@ declare module '@tiptap/core' {
746
788
 
747
789
  declare module '@tiptap/core' {
748
790
  interface Commands<ReturnType> {
749
- katex: {
750
- setKatex: (arg?: IKatexAttrs) => ReturnType;
791
+ tableCellBackground: {
792
+ setTableCellBackground: (color: string) => ReturnType;
793
+ unsetTableCellBackground: () => ReturnType;
751
794
  };
752
795
  }
753
796
  }
@@ -755,13 +798,8 @@ declare module '@tiptap/core' {
755
798
 
756
799
  declare module '@tiptap/core' {
757
800
  interface Commands<ReturnType> {
758
- columns: {
759
- insertColumns: (attrs?: {
760
- cols: number;
761
- }) => ReturnType;
762
- addColBefore: () => ReturnType;
763
- addColAfter: () => ReturnType;
764
- deleteCol: () => ReturnType;
801
+ painter: {
802
+ setPainter: (marks: Mark[]) => ReturnType;
765
803
  };
766
804
  }
767
805
  }
@@ -769,11 +807,14 @@ declare module '@tiptap/core' {
769
807
 
770
808
  declare module '@tiptap/core' {
771
809
  interface Commands<ReturnType> {
772
- emoji: {
773
- setEmoji: (emoji: {
774
- name: string;
775
- emoji: string;
776
- }) => ReturnType;
810
+ search: {
811
+ setSearchTerm: (searchTerm: string) => ReturnType;
812
+ setReplaceTerm: (replaceTerm: string) => ReturnType;
813
+ replace: () => ReturnType;
814
+ replaceAll: () => ReturnType;
815
+ goToPrevSearchResult: () => void;
816
+ goToNextSearchResult: () => void;
817
+ setCaseSensitive: (caseSensitive: boolean) => ReturnType;
777
818
  };
778
819
  }
779
820
  }
@@ -781,9 +822,11 @@ declare module '@tiptap/core' {
781
822
 
782
823
  declare module '@tiptap/core' {
783
824
  interface Commands<ReturnType> {
784
- lineHeight: {
785
- setLineHeight: (lineHeight: string) => ReturnType;
786
- unsetLineHeight: () => ReturnType;
825
+ emoji: {
826
+ setEmoji: (emoji: {
827
+ name: string;
828
+ emoji: string;
829
+ }) => ReturnType;
787
830
  };
788
831
  }
789
832
  }
@@ -791,14 +834,13 @@ declare module '@tiptap/core' {
791
834
 
792
835
  declare module '@tiptap/core' {
793
836
  interface Commands<ReturnType> {
794
- iframe: {
795
- /**
796
- * Add an iframe
797
- */
798
- setIframe: (options: {
799
- src: string;
800
- service: string;
837
+ columns: {
838
+ insertColumns: (attrs?: {
839
+ cols: number;
801
840
  }) => ReturnType;
841
+ addColBefore: () => ReturnType;
842
+ addColAfter: () => ReturnType;
843
+ deleteCol: () => ReturnType;
802
844
  };
803
845
  }
804
846
  }
@@ -806,14 +848,8 @@ declare module '@tiptap/core' {
806
848
 
807
849
  declare module '@tiptap/core' {
808
850
  interface Commands<ReturnType> {
809
- search: {
810
- setSearchTerm: (searchTerm: string) => ReturnType;
811
- setReplaceTerm: (replaceTerm: string) => ReturnType;
812
- replace: () => ReturnType;
813
- replaceAll: () => ReturnType;
814
- goToPrevSearchResult: () => void;
815
- goToNextSearchResult: () => void;
816
- setCaseSensitive: (caseSensitive: boolean) => ReturnType;
851
+ katex: {
852
+ setKatex: (arg?: IKatexAttrs) => ReturnType;
817
853
  };
818
854
  }
819
855
  }
@@ -821,8 +857,8 @@ declare module '@tiptap/core' {
821
857
 
822
858
  declare module '@tiptap/core' {
823
859
  interface Commands<ReturnType> {
824
- painter: {
825
- setPainter: (marks: Mark[]) => ReturnType;
860
+ exportWord: {
861
+ exportToWord: () => ReturnType;
826
862
  };
827
863
  }
828
864
  }
@@ -830,8 +866,8 @@ declare module '@tiptap/core' {
830
866
 
831
867
  declare module '@tiptap/core' {
832
868
  interface Commands<ReturnType> {
833
- exportWord: {
834
- exportToWord: () => ReturnType;
869
+ excalidraw: {
870
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
835
871
  };
836
872
  }
837
873
  }
@@ -847,15 +883,6 @@ declare module '@tiptap/core' {
847
883
  }
848
884
 
849
885
 
850
- declare module '@tiptap/core' {
851
- interface Commands<ReturnType> {
852
- excalidraw: {
853
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
854
- };
855
- }
856
- }
857
-
858
-
859
886
  declare module '@tiptap/core' {
860
887
  interface Commands<ReturnType> {
861
888
  attachment: {
@@ -885,16 +912,6 @@ declare module '@tiptap/core' {
885
912
  }
886
913
 
887
914
 
888
- declare module '@tiptap/core' {
889
- interface Commands<ReturnType> {
890
- drawer: {
891
- setDrawer: (options: any, replace?: any) => ReturnType;
892
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
893
- };
894
- }
895
- }
896
-
897
-
898
915
  declare module '@tiptap/core' {
899
916
  interface Commands<ReturnType> {
900
917
  twitter: {
@@ -910,6 +927,16 @@ declare module '@tiptap/core' {
910
927
  }
911
928
 
912
929
 
930
+ declare module '@tiptap/core' {
931
+ interface Commands<ReturnType> {
932
+ drawer: {
933
+ setDrawer: (options: any, replace?: any) => ReturnType;
934
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
935
+ };
936
+ }
937
+ }
938
+
939
+
913
940
  declare module '@tiptap/core' {
914
941
  interface Commands<ReturnType> {
915
942
  mermaid: {
@@ -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
 
@@ -716,9 +743,24 @@ declare module '@tiptap/core' {
716
743
 
717
744
  declare module '@tiptap/core' {
718
745
  interface Commands<ReturnType> {
719
- tableCellBackground: {
720
- setTableCellBackground: (color: string) => ReturnType;
721
- unsetTableCellBackground: () => 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
+
759
+ declare module '@tiptap/core' {
760
+ interface Commands<ReturnType> {
761
+ lineHeight: {
762
+ setLineHeight: (lineHeight: string) => ReturnType;
763
+ unsetLineHeight: () => ReturnType;
722
764
  };
723
765
  }
724
766
  }
@@ -746,8 +788,9 @@ declare module '@tiptap/core' {
746
788
 
747
789
  declare module '@tiptap/core' {
748
790
  interface Commands<ReturnType> {
749
- katex: {
750
- setKatex: (arg?: IKatexAttrs) => ReturnType;
791
+ tableCellBackground: {
792
+ setTableCellBackground: (color: string) => ReturnType;
793
+ unsetTableCellBackground: () => ReturnType;
751
794
  };
752
795
  }
753
796
  }
@@ -755,13 +798,8 @@ declare module '@tiptap/core' {
755
798
 
756
799
  declare module '@tiptap/core' {
757
800
  interface Commands<ReturnType> {
758
- columns: {
759
- insertColumns: (attrs?: {
760
- cols: number;
761
- }) => ReturnType;
762
- addColBefore: () => ReturnType;
763
- addColAfter: () => ReturnType;
764
- deleteCol: () => ReturnType;
801
+ painter: {
802
+ setPainter: (marks: Mark[]) => ReturnType;
765
803
  };
766
804
  }
767
805
  }
@@ -769,11 +807,14 @@ declare module '@tiptap/core' {
769
807
 
770
808
  declare module '@tiptap/core' {
771
809
  interface Commands<ReturnType> {
772
- emoji: {
773
- setEmoji: (emoji: {
774
- name: string;
775
- emoji: string;
776
- }) => ReturnType;
810
+ search: {
811
+ setSearchTerm: (searchTerm: string) => ReturnType;
812
+ setReplaceTerm: (replaceTerm: string) => ReturnType;
813
+ replace: () => ReturnType;
814
+ replaceAll: () => ReturnType;
815
+ goToPrevSearchResult: () => void;
816
+ goToNextSearchResult: () => void;
817
+ setCaseSensitive: (caseSensitive: boolean) => ReturnType;
777
818
  };
778
819
  }
779
820
  }
@@ -781,9 +822,11 @@ declare module '@tiptap/core' {
781
822
 
782
823
  declare module '@tiptap/core' {
783
824
  interface Commands<ReturnType> {
784
- lineHeight: {
785
- setLineHeight: (lineHeight: string) => ReturnType;
786
- unsetLineHeight: () => ReturnType;
825
+ emoji: {
826
+ setEmoji: (emoji: {
827
+ name: string;
828
+ emoji: string;
829
+ }) => ReturnType;
787
830
  };
788
831
  }
789
832
  }
@@ -791,14 +834,13 @@ declare module '@tiptap/core' {
791
834
 
792
835
  declare module '@tiptap/core' {
793
836
  interface Commands<ReturnType> {
794
- iframe: {
795
- /**
796
- * Add an iframe
797
- */
798
- setIframe: (options: {
799
- src: string;
800
- service: string;
837
+ columns: {
838
+ insertColumns: (attrs?: {
839
+ cols: number;
801
840
  }) => ReturnType;
841
+ addColBefore: () => ReturnType;
842
+ addColAfter: () => ReturnType;
843
+ deleteCol: () => ReturnType;
802
844
  };
803
845
  }
804
846
  }
@@ -806,14 +848,8 @@ declare module '@tiptap/core' {
806
848
 
807
849
  declare module '@tiptap/core' {
808
850
  interface Commands<ReturnType> {
809
- search: {
810
- setSearchTerm: (searchTerm: string) => ReturnType;
811
- setReplaceTerm: (replaceTerm: string) => ReturnType;
812
- replace: () => ReturnType;
813
- replaceAll: () => ReturnType;
814
- goToPrevSearchResult: () => void;
815
- goToNextSearchResult: () => void;
816
- setCaseSensitive: (caseSensitive: boolean) => ReturnType;
851
+ katex: {
852
+ setKatex: (arg?: IKatexAttrs) => ReturnType;
817
853
  };
818
854
  }
819
855
  }
@@ -821,8 +857,8 @@ declare module '@tiptap/core' {
821
857
 
822
858
  declare module '@tiptap/core' {
823
859
  interface Commands<ReturnType> {
824
- painter: {
825
- setPainter: (marks: Mark[]) => ReturnType;
860
+ exportWord: {
861
+ exportToWord: () => ReturnType;
826
862
  };
827
863
  }
828
864
  }
@@ -830,8 +866,8 @@ declare module '@tiptap/core' {
830
866
 
831
867
  declare module '@tiptap/core' {
832
868
  interface Commands<ReturnType> {
833
- exportWord: {
834
- exportToWord: () => ReturnType;
869
+ excalidraw: {
870
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
835
871
  };
836
872
  }
837
873
  }
@@ -847,15 +883,6 @@ declare module '@tiptap/core' {
847
883
  }
848
884
 
849
885
 
850
- declare module '@tiptap/core' {
851
- interface Commands<ReturnType> {
852
- excalidraw: {
853
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
854
- };
855
- }
856
- }
857
-
858
-
859
886
  declare module '@tiptap/core' {
860
887
  interface Commands<ReturnType> {
861
888
  attachment: {
@@ -885,16 +912,6 @@ declare module '@tiptap/core' {
885
912
  }
886
913
 
887
914
 
888
- declare module '@tiptap/core' {
889
- interface Commands<ReturnType> {
890
- drawer: {
891
- setDrawer: (options: any, replace?: any) => ReturnType;
892
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
893
- };
894
- }
895
- }
896
-
897
-
898
915
  declare module '@tiptap/core' {
899
916
  interface Commands<ReturnType> {
900
917
  twitter: {
@@ -910,6 +927,16 @@ declare module '@tiptap/core' {
910
927
  }
911
928
 
912
929
 
930
+ declare module '@tiptap/core' {
931
+ interface Commands<ReturnType> {
932
+ drawer: {
933
+ setDrawer: (options: any, replace?: any) => ReturnType;
934
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
935
+ };
936
+ }
937
+ }
938
+
939
+
913
940
  declare module '@tiptap/core' {
914
941
  interface Commands<ReturnType> {
915
942
  mermaid: {