@flogeez/angular-tiptap-editor 0.3.7 → 0.5.0

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Editor } from '@tiptap/core';
1
+ import { Editor, Extension, Node, Mark, EditorOptions } from '@tiptap/core';
2
2
  import * as _angular_core from '@angular/core';
3
3
  import { AfterViewInit, OnDestroy, ElementRef } from '@angular/core';
4
4
  import { Observable } from 'rxjs';
@@ -32,6 +32,7 @@ interface TiptapTranslations {
32
32
  undo: string;
33
33
  redo: string;
34
34
  clear: string;
35
+ textColor: string;
35
36
  };
36
37
  bubbleMenu: {
37
38
  bold: string;
@@ -42,6 +43,7 @@ interface TiptapTranslations {
42
43
  superscript: string;
43
44
  subscript: string;
44
45
  highlight: string;
46
+ textColor: string;
45
47
  link: string;
46
48
  addLink: string;
47
49
  editLink: string;
@@ -117,6 +119,7 @@ interface TiptapTranslations {
117
119
  };
118
120
  imageUpload: {
119
121
  selectImage: string;
122
+ loadError: string;
120
123
  uploadingImage: string;
121
124
  uploadProgress: string;
122
125
  uploadError: string;
@@ -130,12 +133,20 @@ interface TiptapTranslations {
130
133
  resizeMedium: string;
131
134
  resizeLarge: string;
132
135
  resizeOriginal: string;
136
+ resizing: string;
137
+ compressing: string;
138
+ compressionError: string;
139
+ validating: string;
140
+ uploadingToServer: string;
141
+ replacingImage: string;
142
+ insertingImage: string;
143
+ noFileSelected: string;
144
+ selectionCancelled: string;
133
145
  };
134
146
  editor: {
135
147
  placeholder: string;
136
148
  character: string;
137
149
  word: string;
138
- imageLoadError: string;
139
150
  linkPrompt: string;
140
151
  linkUrlPrompt: string;
141
152
  confirmDelete: string;
@@ -184,6 +195,7 @@ declare class TiptapI18nService {
184
195
  undo: string;
185
196
  redo: string;
186
197
  clear: string;
198
+ textColor: string;
187
199
  }>;
188
200
  readonly bubbleMenu: _angular_core.Signal<{
189
201
  bold: string;
@@ -194,6 +206,7 @@ declare class TiptapI18nService {
194
206
  superscript: string;
195
207
  subscript: string;
196
208
  highlight: string;
209
+ textColor: string;
197
210
  link: string;
198
211
  addLink: string;
199
212
  editLink: string;
@@ -269,6 +282,7 @@ declare class TiptapI18nService {
269
282
  }>;
270
283
  readonly imageUpload: _angular_core.Signal<{
271
284
  selectImage: string;
285
+ loadError: string;
272
286
  uploadingImage: string;
273
287
  uploadProgress: string;
274
288
  uploadError: string;
@@ -282,12 +296,20 @@ declare class TiptapI18nService {
282
296
  resizeMedium: string;
283
297
  resizeLarge: string;
284
298
  resizeOriginal: string;
299
+ resizing: string;
300
+ compressing: string;
301
+ compressionError: string;
302
+ validating: string;
303
+ uploadingToServer: string;
304
+ replacingImage: string;
305
+ insertingImage: string;
306
+ noFileSelected: string;
307
+ selectionCancelled: string;
285
308
  }>;
286
309
  readonly editor: _angular_core.Signal<{
287
310
  placeholder: string;
288
311
  character: string;
289
312
  word: string;
290
- imageLoadError: string;
291
313
  linkPrompt: string;
292
314
  linkUrlPrompt: string;
293
315
  confirmDelete: string;
@@ -368,10 +390,9 @@ interface SlashCommandItem {
368
390
  keywords: string[];
369
391
  command: (editor: Editor) => void;
370
392
  }
371
- interface SlashCommandsConfig {
393
+ interface CustomSlashCommands {
372
394
  commands?: SlashCommandItem[];
373
395
  }
374
- declare const DEFAULT_SLASH_COMMANDS: SlashCommandItem[];
375
396
 
376
397
  interface ImageData {
377
398
  src: string;
@@ -456,6 +477,8 @@ declare class ImageService {
456
477
  selectedImage: _angular_core.WritableSignal<ImageData | null>;
457
478
  isImageSelected: _angular_core.Signal<boolean>;
458
479
  isResizing: _angular_core.WritableSignal<boolean>;
480
+ private i18n;
481
+ private readonly t;
459
482
  isUploading: _angular_core.WritableSignal<boolean>;
460
483
  uploadProgress: _angular_core.WritableSignal<number>;
461
484
  uploadMessage: _angular_core.WritableSignal<string>;
@@ -570,10 +593,50 @@ declare class EditorCommandsService {
570
593
  blur(editor: Editor): void;
571
594
  setContent(editor: Editor, content: string, emitUpdate?: boolean): void;
572
595
  setEditable(editor: Editor, editable: boolean): void;
596
+ insertContent(editor: Editor, content: string): void;
573
597
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EditorCommandsService, never>;
574
598
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<EditorCommandsService>;
575
599
  }
576
600
 
601
+ /**
602
+ * Clés des commandes natives dans l'ordre d'affichage
603
+ */
604
+ declare const SLASH_COMMAND_KEYS: readonly ["heading1", "heading2", "heading3", "bulletList", "orderedList", "blockquote", "code", "image", "horizontalRule", "table"];
605
+ type SlashCommandKey = (typeof SLASH_COMMAND_KEYS)[number];
606
+ /**
607
+ * Configuration simplifiée pour activer/désactiver les slash commands natives.
608
+ * Permet aussi d'ajouter des commandes personnalisées.
609
+ */
610
+ interface SlashCommandsConfig extends Partial<Record<SlashCommandKey, boolean>> {
611
+ /**
612
+ * Liste de commandes supplémentaires à ajouter à la fin du menu
613
+ */
614
+ custom?: SlashCommandItem[];
615
+ }
616
+ /**
617
+ * Configuration par défaut : toutes les commandes natives sont activées
618
+ */
619
+ declare const DEFAULT_SLASH_COMMANDS_CONFIG: Record<SlashCommandKey, boolean>;
620
+ /**
621
+ * Factory pour créer les commandes natives avec leurs traductions et leur logique d'exécution.
622
+ * Utilise les services de l'éditeur pour garantir une cohérence de comportement.
623
+ */
624
+ declare function createDefaultSlashCommands(i18n: TiptapI18nService, commands: EditorCommandsService, images: ImageService, imageOptions?: {
625
+ quality?: number;
626
+ maxWidth?: number;
627
+ maxHeight?: number;
628
+ allowedTypes?: string[];
629
+ }): SlashCommandItem[];
630
+ /**
631
+ * Filtre et assemble les commandes selon la configuration fournie.
632
+ */
633
+ declare function filterSlashCommands(config: SlashCommandsConfig, i18n: TiptapI18nService, commands: EditorCommandsService, images: ImageService, imageOptions?: {
634
+ quality?: number;
635
+ maxWidth?: number;
636
+ maxHeight?: number;
637
+ allowedTypes?: string[];
638
+ }): SlashCommandItem[];
639
+
577
640
  interface ToolbarConfig {
578
641
  bold?: boolean;
579
642
  italic?: boolean;
@@ -600,6 +663,7 @@ interface ToolbarConfig {
600
663
  undo?: boolean;
601
664
  redo?: boolean;
602
665
  clear?: boolean;
666
+ textColor?: boolean;
603
667
  separator?: boolean;
604
668
  }
605
669
 
@@ -612,6 +676,7 @@ interface BubbleMenuConfig {
612
676
  superscript?: boolean;
613
677
  subscript?: boolean;
614
678
  highlight?: boolean;
679
+ textColor?: boolean;
615
680
  link?: boolean;
616
681
  separator?: boolean;
617
682
  }
@@ -667,9 +732,12 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
667
732
  maxCharacters: _angular_core.InputSignal<number | undefined>;
668
733
  enableOfficePaste: _angular_core.InputSignal<boolean>;
669
734
  enableSlashCommands: _angular_core.InputSignal<boolean>;
670
- slashCommandsConfig: _angular_core.InputSignal<SlashCommandsConfig | undefined>;
735
+ slashCommands: _angular_core.InputSignal<SlashCommandsConfig>;
736
+ customSlashCommands: _angular_core.InputSignal<CustomSlashCommands | undefined>;
671
737
  locale: _angular_core.InputSignal<SupportedLocale | undefined>;
672
- autofocus: _angular_core.InputSignal<number | boolean | "end" | "start" | "all">;
738
+ autofocus: _angular_core.InputSignal<number | boolean | "start" | "end" | "all">;
739
+ tiptapExtensions: _angular_core.InputSignal<(Extension<any, any> | Node<any, any> | Mark<any, any>)[]>;
740
+ tiptapOptions: _angular_core.InputSignal<Partial<EditorOptions>>;
673
741
  showBubbleMenu: _angular_core.InputSignal<boolean>;
674
742
  bubbleMenu: _angular_core.InputSignal<Partial<BubbleMenuConfig>>;
675
743
  showImageBubbleMenu: _angular_core.InputSignal<boolean>;
@@ -751,7 +819,7 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
751
819
  compressImages: boolean;
752
820
  quality: number;
753
821
  }>;
754
- slashCommandsConfigComputed: _angular_core.Signal<SlashCommandsConfig>;
822
+ slashCommandsConfigComputed: _angular_core.Signal<CustomSlashCommands>;
755
823
  private _destroyRef;
756
824
  private ngControl;
757
825
  readonly i18nService: TiptapI18nService;
@@ -762,8 +830,6 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
762
830
  ngOnDestroy(): void;
763
831
  private initEditor;
764
832
  private updateCharacterCount;
765
- onImageUploaded(result: ImageUploadResult): void;
766
- onImageUploadError(error: string): void;
767
833
  onSlashCommandImageUpload(file: File): Promise<void>;
768
834
  onDragOver(event: DragEvent): void;
769
835
  onDrop(event: DragEvent): void;
@@ -780,27 +846,14 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
780
846
  setDisabledState(isDisabled: boolean): void;
781
847
  onEditorClick(event: MouseEvent): void;
782
848
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AngularTiptapEditorComponent, never>;
783
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<AngularTiptapEditorComponent, "angular-tiptap-editor", never, { "content": { "alias": "content"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "minHeight": { "alias": "minHeight"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "fillContainer": { "alias": "fillContainer"; "required": false; "isSignal": true; }; "showToolbar": { "alias": "showToolbar"; "required": false; "isSignal": true; }; "showCharacterCount": { "alias": "showCharacterCount"; "required": false; "isSignal": true; }; "maxCharacters": { "alias": "maxCharacters"; "required": false; "isSignal": true; }; "enableOfficePaste": { "alias": "enableOfficePaste"; "required": false; "isSignal": true; }; "enableSlashCommands": { "alias": "enableSlashCommands"; "required": false; "isSignal": true; }; "slashCommandsConfig": { "alias": "slashCommandsConfig"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; "showBubbleMenu": { "alias": "showBubbleMenu"; "required": false; "isSignal": true; }; "bubbleMenu": { "alias": "bubbleMenu"; "required": false; "isSignal": true; }; "showImageBubbleMenu": { "alias": "showImageBubbleMenu"; "required": false; "isSignal": true; }; "imageBubbleMenu": { "alias": "imageBubbleMenu"; "required": false; "isSignal": true; }; "toolbar": { "alias": "toolbar"; "required": false; "isSignal": true; }; "imageUpload": { "alias": "imageUpload"; "required": false; "isSignal": true; }; "imageUploadHandler": { "alias": "imageUploadHandler"; "required": false; "isSignal": true; }; }, { "contentChange": "contentChange"; "editorCreated": "editorCreated"; "editorUpdate": "editorUpdate"; "editorFocus": "editorFocus"; "editorBlur": "editorBlur"; }, never, never, true, [{ directive: typeof NoopValueAccessorDirective; inputs: {}; outputs: {}; }]>;
849
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AngularTiptapEditorComponent, "angular-tiptap-editor", never, { "content": { "alias": "content"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "minHeight": { "alias": "minHeight"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "fillContainer": { "alias": "fillContainer"; "required": false; "isSignal": true; }; "showToolbar": { "alias": "showToolbar"; "required": false; "isSignal": true; }; "showCharacterCount": { "alias": "showCharacterCount"; "required": false; "isSignal": true; }; "maxCharacters": { "alias": "maxCharacters"; "required": false; "isSignal": true; }; "enableOfficePaste": { "alias": "enableOfficePaste"; "required": false; "isSignal": true; }; "enableSlashCommands": { "alias": "enableSlashCommands"; "required": false; "isSignal": true; }; "slashCommands": { "alias": "slashCommands"; "required": false; "isSignal": true; }; "customSlashCommands": { "alias": "customSlashCommands"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; "tiptapExtensions": { "alias": "tiptapExtensions"; "required": false; "isSignal": true; }; "tiptapOptions": { "alias": "tiptapOptions"; "required": false; "isSignal": true; }; "showBubbleMenu": { "alias": "showBubbleMenu"; "required": false; "isSignal": true; }; "bubbleMenu": { "alias": "bubbleMenu"; "required": false; "isSignal": true; }; "showImageBubbleMenu": { "alias": "showImageBubbleMenu"; "required": false; "isSignal": true; }; "imageBubbleMenu": { "alias": "imageBubbleMenu"; "required": false; "isSignal": true; }; "toolbar": { "alias": "toolbar"; "required": false; "isSignal": true; }; "imageUpload": { "alias": "imageUpload"; "required": false; "isSignal": true; }; "imageUploadHandler": { "alias": "imageUploadHandler"; "required": false; "isSignal": true; }; }, { "contentChange": "contentChange"; "editorCreated": "editorCreated"; "editorUpdate": "editorUpdate"; "editorFocus": "editorFocus"; "editorBlur": "editorBlur"; }, never, never, true, [{ directive: typeof NoopValueAccessorDirective; inputs: {}; outputs: {}; }]>;
784
850
  }
785
851
 
786
- /**
787
- * Clés des commandes dans l'ordre de création
788
- */
789
- declare const SLASH_COMMAND_KEYS: readonly ["heading1", "heading2", "heading3", "bulletList", "orderedList", "blockquote", "code", "image", "horizontalRule", "table"];
790
- /**
791
- * Factory function pour créer les slash commands traduits
792
- */
793
- declare function createI18nSlashCommands(i18nService: TiptapI18nService): SlashCommandItem[];
794
- /**
795
- * Fonction utilitaire pour filtrer les slash commands selon les commandes actives
796
- */
797
- declare function filterSlashCommands(activeCommands: Set<string>, i18nService: TiptapI18nService): SlashCommandItem[];
798
-
799
852
  type HeightConfig = {
800
853
  minHeight?: number;
801
854
  height?: number;
802
855
  maxHeight?: number;
803
856
  };
804
857
 
805
- export { AngularTiptapEditorComponent, DEFAULT_BUBBLE_MENU_CONFIG, DEFAULT_CELL_MENU_CONFIG, DEFAULT_IMAGE_BUBBLE_MENU_CONFIG, DEFAULT_SLASH_COMMANDS, DEFAULT_TABLE_MENU_CONFIG, DEFAULT_TOOLBAR_CONFIG, EditorCommandsService, ImageService, NoopValueAccessorDirective, SLASH_COMMAND_KEYS, TiptapI18nService, createI18nSlashCommands, filterSlashCommands };
806
- export type { BubbleMenuConfig, CellBubbleMenuConfig, HeightConfig, ImageBubbleMenuConfig, ImageData, ImageUploadContext, ImageUploadHandler, ImageUploadHandlerResult, ImageUploadResult, ResizeOptions, SlashCommandItem, SlashCommandsConfig, SupportedLocale, TableBubbleMenuConfig, TiptapTranslations, ToolbarConfig };
858
+ export { AngularTiptapEditorComponent, DEFAULT_BUBBLE_MENU_CONFIG, DEFAULT_CELL_MENU_CONFIG, DEFAULT_IMAGE_BUBBLE_MENU_CONFIG, DEFAULT_SLASH_COMMANDS_CONFIG, DEFAULT_TABLE_MENU_CONFIG, DEFAULT_TOOLBAR_CONFIG, EditorCommandsService, ImageService, NoopValueAccessorDirective, SLASH_COMMAND_KEYS, TiptapI18nService, createDefaultSlashCommands, filterSlashCommands };
859
+ export type { BubbleMenuConfig, CellBubbleMenuConfig, CustomSlashCommands, HeightConfig, ImageBubbleMenuConfig, ImageData, ImageUploadContext, ImageUploadHandler, ImageUploadHandlerResult, ImageUploadResult, ResizeOptions, SlashCommandItem, SlashCommandKey, SlashCommandsConfig, SupportedLocale, TableBubbleMenuConfig, TiptapTranslations, ToolbarConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flogeez/angular-tiptap-editor",
3
- "version": "0.3.7",
3
+ "version": "0.5.0",
4
4
  "description": "A modern, customizable rich-text editor for Angular (18+), built with Tiptap and featuring complete internationalization support",
5
5
  "keywords": [
6
6
  "angular",
@@ -2,6 +2,8 @@
2
2
  .tippy-box {
3
3
  /* Par défaut Tippy limite à 350px */
4
4
  max-width: none !important;
5
+ background: transparent !important;
6
+ box-shadow: none !important;
5
7
  }
6
8
 
7
9
  .tippy-content {
@@ -10,32 +12,31 @@
10
12
  }
11
13
 
12
14
  .tippy-box .bubble-menu {
13
- display: flex;
15
+ display: flex !important;
14
16
  align-items: center;
15
17
  gap: 6px;
16
- background: rgba(255, 255, 255, 0.95);
17
- backdrop-filter: blur(12px);
18
- border: 1px solid rgba(255, 255, 255, 0.2);
19
- border-radius: 16px;
18
+ background: var(--ate-menu-bg, rgba(255, 255, 255, 0.95)) !important;
19
+ backdrop-filter: blur(var(--ate-menu-blur, 12px));
20
+ border: 1px solid var(--ate-menu-border, rgba(0, 0, 0, 0.1));
21
+ border-radius: var(--ate-border-radius, 16px);
20
22
  padding: 8px 12px;
21
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
23
+ box-shadow: var(--ate-menu-shadow, 0 8px 32px rgba(0, 0, 0, 0.12));
22
24
  z-index: 1000;
23
- animation: slideUp 0.2s cubic-bezier(0.4, 0, 0.2, 1);
24
- /* Empêcher les retours à la ligne pour des barres d'icônes */
25
+ animation: slideUp 0.18s cubic-bezier(0, 0, 0.2, 1);
25
26
  white-space: nowrap;
26
27
  }
27
28
 
28
29
  .bubble-menu .tiptap-separator {
29
30
  width: 1px;
30
31
  height: 28px;
31
- background: linear-gradient(to bottom, transparent, #e2e8f0, transparent);
32
+ background: color-mix(in srgb, var(--ate-menu-border), transparent 50%);
32
33
  margin: 0 4px;
33
34
  }
34
35
 
35
36
  @keyframes slideUp {
36
37
  from {
37
38
  opacity: 0;
38
- transform: translateY(8px) scale(0.95);
39
+ transform: translateY(6px) scale(0.98);
39
40
  }
40
41
  to {
41
42
  opacity: 1;
@@ -1,40 +1,40 @@
1
- @import "./bubble-menu.global.css";
2
- @import "./material-symbols.css";
3
-
4
- /* Styles pour les liens */
5
- .tiptap-link {
6
- color: #3b82f6;
7
- text-decoration: underline;
8
- cursor: pointer;
9
- transition: color 0.2s ease;
10
- }
11
-
12
- .tiptap-link:hover {
13
- color: #1d4ed8;
14
- text-decoration: underline;
15
- }
16
-
17
- /* Styles pour la surbrillance */
18
- .tiptap-highlight {
19
- background-color: #fef08a;
20
- padding: 0.1em 0.2em;
21
- border-radius: 2px;
22
- color: #854d0e;
23
- }
24
-
25
- /* Styles pour les alignements de texte - Tiptap utilise des classes */
26
- .ProseMirror .has-text-align-left {
27
- text-align: left;
28
- }
29
-
30
- .ProseMirror .has-text-align-center {
31
- text-align: center;
32
- }
33
-
34
- .ProseMirror .has-text-align-right {
35
- text-align: right;
36
- }
37
-
38
- .ProseMirror .has-text-align-justify {
39
- text-align: justify;
40
- }
1
+ @import "./bubble-menu.global.css";
2
+ @import "./material-symbols.css";
3
+
4
+ /* Styles pour les liens */
5
+ .tiptap-link {
6
+ color: var(--ate-primary, #1d4ed8);
7
+ text-decoration: underline;
8
+ cursor: pointer;
9
+ transition: color 0.2s ease;
10
+ }
11
+
12
+ .tiptap-link:hover {
13
+ color: var(--ate-primary-light-alpha, #1d4ed8);
14
+ text-decoration: underline;
15
+ }
16
+
17
+ /* Styles pour la surbrillance */
18
+ .tiptap-highlight {
19
+ background-color: var(--ate-highlight-bg, #fef08a);
20
+ padding: 0.1em 0.2em;
21
+ border-radius: 2px;
22
+ color: var(--ate-highlight-color, #854d0e);
23
+ }
24
+
25
+ /* Styles pour les alignements de texte - Tiptap utilise des classes */
26
+ .ProseMirror .has-text-align-left {
27
+ text-align: left;
28
+ }
29
+
30
+ .ProseMirror .has-text-align-center {
31
+ text-align: center;
32
+ }
33
+
34
+ .ProseMirror .has-text-align-right {
35
+ text-align: right;
36
+ }
37
+
38
+ .ProseMirror .has-text-align-justify {
39
+ text-align: justify;
40
+ }