@flogeez/angular-tiptap-editor 0.2.6 → 0.3.1

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
@@ -3,102 +3,6 @@ import * as _angular_core from '@angular/core';
3
3
  import { AfterViewInit, OnDestroy, ElementRef } from '@angular/core';
4
4
  import { ControlValueAccessor } from '@angular/forms';
5
5
 
6
- interface SlashCommandItem {
7
- title: string;
8
- description: string;
9
- icon: string;
10
- keywords: string[];
11
- command: (editor: Editor) => void;
12
- }
13
- interface SlashCommandsConfig {
14
- commands?: SlashCommandItem[];
15
- }
16
- declare const DEFAULT_SLASH_COMMANDS: SlashCommandItem[];
17
-
18
- interface ImageData {
19
- src: string;
20
- alt?: string;
21
- title?: string;
22
- width?: number;
23
- height?: number;
24
- }
25
- interface ImageUploadResult {
26
- src: string;
27
- name: string;
28
- size: number;
29
- type: string;
30
- width?: number;
31
- height?: number;
32
- originalSize?: number;
33
- }
34
- interface ResizeOptions {
35
- width?: number;
36
- height?: number;
37
- maintainAspectRatio?: boolean;
38
- }
39
- declare class ImageService {
40
- selectedImage: _angular_core.WritableSignal<ImageData | null>;
41
- isImageSelected: _angular_core.Signal<boolean>;
42
- isResizing: _angular_core.WritableSignal<boolean>;
43
- isUploading: _angular_core.WritableSignal<boolean>;
44
- uploadProgress: _angular_core.WritableSignal<number>;
45
- uploadMessage: _angular_core.WritableSignal<string>;
46
- private currentEditor;
47
- selectImage(editor: Editor): void;
48
- clearSelection(): void;
49
- insertImage(editor: Editor, imageData: ImageData): void;
50
- updateImageAttributes(editor: Editor, attributes: Partial<ImageData>): void;
51
- resizeImage(editor: Editor, options: ResizeOptions): void;
52
- resizeImageByPercentage(editor: Editor, percentage: number): void;
53
- resizeImageToSmall(editor: Editor): void;
54
- resizeImageToMedium(editor: Editor): void;
55
- resizeImageToLarge(editor: Editor): void;
56
- resizeImageToOriginal(editor: Editor): void;
57
- resizeImageFreely(editor: Editor, width: number, height: number): void;
58
- getImageDimensions(editor: Editor): {
59
- width: number;
60
- height: number;
61
- } | null;
62
- getNaturalImageDimensions(src: string): Promise<{
63
- width: number;
64
- height: number;
65
- }>;
66
- deleteImage(editor: Editor): void;
67
- private updateSelectedImage;
68
- validateImage(file: File, maxSize?: number): {
69
- valid: boolean;
70
- error?: string;
71
- };
72
- compressImage(file: File, quality?: number, maxWidth?: number, maxHeight?: number): Promise<ImageUploadResult>;
73
- private uploadImageWithProgress;
74
- uploadAndInsertImage(editor: Editor, file: File, options?: {
75
- quality?: number;
76
- maxWidth?: number;
77
- maxHeight?: number;
78
- }): Promise<void>;
79
- private forceEditorUpdate;
80
- private selectFileAndProcess;
81
- selectAndUploadImage(editor: Editor, options?: {
82
- quality?: number;
83
- maxWidth?: number;
84
- maxHeight?: number;
85
- accept?: string;
86
- }): Promise<void>;
87
- selectAndReplaceImage(editor: Editor, options?: {
88
- quality?: number;
89
- maxWidth?: number;
90
- maxHeight?: number;
91
- accept?: string;
92
- }): Promise<void>;
93
- uploadAndReplaceImage(editor: Editor, file: File, options?: {
94
- quality?: number;
95
- maxWidth?: number;
96
- maxHeight?: number;
97
- }): Promise<void>;
98
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ImageService, never>;
99
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<ImageService>;
100
- }
101
-
102
6
  type SupportedLocale = "en" | "fr";
103
7
  interface TiptapTranslations {
104
8
  toolbar: {
@@ -123,8 +27,10 @@ interface TiptapTranslations {
123
27
  link: string;
124
28
  image: string;
125
29
  horizontalRule: string;
30
+ table: string;
126
31
  undo: string;
127
32
  redo: string;
33
+ clear: string;
128
34
  };
129
35
  bubbleMenu: {
130
36
  bold: string;
@@ -189,6 +95,24 @@ interface TiptapTranslations {
189
95
  description: string;
190
96
  keywords: string[];
191
97
  };
98
+ table: {
99
+ title: string;
100
+ description: string;
101
+ keywords: string[];
102
+ };
103
+ };
104
+ table: {
105
+ addRowBefore: string;
106
+ addRowAfter: string;
107
+ deleteRow: string;
108
+ addColumnBefore: string;
109
+ addColumnAfter: string;
110
+ deleteColumn: string;
111
+ deleteTable: string;
112
+ toggleHeaderRow: string;
113
+ toggleHeaderColumn: string;
114
+ mergeCells: string;
115
+ splitCell: string;
192
116
  };
193
117
  imageUpload: {
194
118
  selectImage: string;
@@ -208,8 +132,8 @@ interface TiptapTranslations {
208
132
  };
209
133
  editor: {
210
134
  placeholder: string;
211
- characters: string;
212
- words: string;
135
+ character: string;
136
+ word: string;
213
137
  imageLoadError: string;
214
138
  linkPrompt: string;
215
139
  linkUrlPrompt: string;
@@ -255,8 +179,10 @@ declare class TiptapI18nService {
255
179
  link: string;
256
180
  image: string;
257
181
  horizontalRule: string;
182
+ table: string;
258
183
  undo: string;
259
184
  redo: string;
185
+ clear: string;
260
186
  }>;
261
187
  readonly bubbleMenu: _angular_core.Signal<{
262
188
  bold: string;
@@ -321,6 +247,24 @@ declare class TiptapI18nService {
321
247
  description: string;
322
248
  keywords: string[];
323
249
  };
250
+ table: {
251
+ title: string;
252
+ description: string;
253
+ keywords: string[];
254
+ };
255
+ }>;
256
+ readonly table: _angular_core.Signal<{
257
+ addRowBefore: string;
258
+ addRowAfter: string;
259
+ deleteRow: string;
260
+ addColumnBefore: string;
261
+ addColumnAfter: string;
262
+ deleteColumn: string;
263
+ deleteTable: string;
264
+ toggleHeaderRow: string;
265
+ toggleHeaderColumn: string;
266
+ mergeCells: string;
267
+ splitCell: string;
324
268
  }>;
325
269
  readonly imageUpload: _angular_core.Signal<{
326
270
  selectImage: string;
@@ -340,8 +284,8 @@ declare class TiptapI18nService {
340
284
  }>;
341
285
  readonly editor: _angular_core.Signal<{
342
286
  placeholder: string;
343
- characters: string;
344
- words: string;
287
+ character: string;
288
+ word: string;
345
289
  imageLoadError: string;
346
290
  linkPrompt: string;
347
291
  linkUrlPrompt: string;
@@ -402,11 +346,116 @@ declare class TiptapI18nService {
402
346
  title: string;
403
347
  description: string;
404
348
  keywords: string[];
349
+ } | {
350
+ title: string;
351
+ description: string;
352
+ keywords: string[];
405
353
  };
406
354
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TiptapI18nService, never>;
407
355
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<TiptapI18nService>;
408
356
  }
409
357
 
358
+ interface CellBubbleMenuConfig$1 {
359
+ mergeCells?: boolean;
360
+ splitCell?: boolean;
361
+ }
362
+
363
+ interface SlashCommandItem {
364
+ title: string;
365
+ description: string;
366
+ icon: string;
367
+ keywords: string[];
368
+ command: (editor: Editor) => void;
369
+ }
370
+ interface SlashCommandsConfig {
371
+ commands?: SlashCommandItem[];
372
+ }
373
+ declare const DEFAULT_SLASH_COMMANDS: SlashCommandItem[];
374
+
375
+ interface ImageData {
376
+ src: string;
377
+ alt?: string;
378
+ title?: string;
379
+ width?: number;
380
+ height?: number;
381
+ }
382
+ interface ImageUploadResult {
383
+ src: string;
384
+ name: string;
385
+ size: number;
386
+ type: string;
387
+ width?: number;
388
+ height?: number;
389
+ originalSize?: number;
390
+ }
391
+ interface ResizeOptions {
392
+ width?: number;
393
+ height?: number;
394
+ maintainAspectRatio?: boolean;
395
+ }
396
+ declare class ImageService {
397
+ selectedImage: _angular_core.WritableSignal<ImageData | null>;
398
+ isImageSelected: _angular_core.Signal<boolean>;
399
+ isResizing: _angular_core.WritableSignal<boolean>;
400
+ isUploading: _angular_core.WritableSignal<boolean>;
401
+ uploadProgress: _angular_core.WritableSignal<number>;
402
+ uploadMessage: _angular_core.WritableSignal<string>;
403
+ private currentEditor;
404
+ selectImage(editor: Editor): void;
405
+ clearSelection(): void;
406
+ insertImage(editor: Editor, imageData: ImageData): void;
407
+ updateImageAttributes(editor: Editor, attributes: Partial<ImageData>): void;
408
+ resizeImage(editor: Editor, options: ResizeOptions): void;
409
+ resizeImageByPercentage(editor: Editor, percentage: number): void;
410
+ resizeImageToSmall(editor: Editor): void;
411
+ resizeImageToMedium(editor: Editor): void;
412
+ resizeImageToLarge(editor: Editor): void;
413
+ resizeImageToOriginal(editor: Editor): void;
414
+ resizeImageFreely(editor: Editor, width: number, height: number): void;
415
+ getImageDimensions(editor: Editor): {
416
+ width: number;
417
+ height: number;
418
+ } | null;
419
+ getNaturalImageDimensions(src: string): Promise<{
420
+ width: number;
421
+ height: number;
422
+ }>;
423
+ deleteImage(editor: Editor): void;
424
+ private updateSelectedImage;
425
+ validateImage(file: File, maxSize?: number): {
426
+ valid: boolean;
427
+ error?: string;
428
+ };
429
+ compressImage(file: File, quality?: number, maxWidth?: number, maxHeight?: number): Promise<ImageUploadResult>;
430
+ private uploadImageWithProgress;
431
+ uploadAndInsertImage(editor: Editor, file: File, options?: {
432
+ quality?: number;
433
+ maxWidth?: number;
434
+ maxHeight?: number;
435
+ }): Promise<void>;
436
+ private forceEditorUpdate;
437
+ private selectFileAndProcess;
438
+ selectAndUploadImage(editor: Editor, options?: {
439
+ quality?: number;
440
+ maxWidth?: number;
441
+ maxHeight?: number;
442
+ accept?: string;
443
+ }): Promise<void>;
444
+ selectAndReplaceImage(editor: Editor, options?: {
445
+ quality?: number;
446
+ maxWidth?: number;
447
+ maxHeight?: number;
448
+ accept?: string;
449
+ }): Promise<void>;
450
+ uploadAndReplaceImage(editor: Editor, file: File, options?: {
451
+ quality?: number;
452
+ maxWidth?: number;
453
+ maxHeight?: number;
454
+ }): Promise<void>;
455
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ImageService, never>;
456
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<ImageService>;
457
+ }
458
+
410
459
  interface ToolbarConfig {
411
460
  bold?: boolean;
412
461
  italic?: boolean;
@@ -429,8 +478,10 @@ interface ToolbarConfig {
429
478
  link?: boolean;
430
479
  image?: boolean;
431
480
  horizontalRule?: boolean;
481
+ table?: boolean;
432
482
  undo?: boolean;
433
483
  redo?: boolean;
484
+ clear?: boolean;
434
485
  separator?: boolean;
435
486
  }
436
487
 
@@ -455,6 +506,22 @@ interface ImageBubbleMenuConfig {
455
506
  deleteImage?: boolean;
456
507
  separator?: boolean;
457
508
  }
509
+ interface TableBubbleMenuConfig {
510
+ addRowBefore?: boolean;
511
+ addRowAfter?: boolean;
512
+ deleteRow?: boolean;
513
+ addColumnBefore?: boolean;
514
+ addColumnAfter?: boolean;
515
+ deleteColumn?: boolean;
516
+ deleteTable?: boolean;
517
+ toggleHeaderRow?: boolean;
518
+ toggleHeaderColumn?: boolean;
519
+ separator?: boolean;
520
+ }
521
+ interface CellBubbleMenuConfig {
522
+ mergeCells?: boolean;
523
+ splitCell?: boolean;
524
+ }
458
525
 
459
526
  declare class NoopValueAccessorDirective implements ControlValueAccessor {
460
527
  writeValue(obj: any): void;
@@ -467,6 +534,8 @@ declare class NoopValueAccessorDirective implements ControlValueAccessor {
467
534
  declare const DEFAULT_TOOLBAR_CONFIG: ToolbarConfig;
468
535
  declare const DEFAULT_BUBBLE_MENU_CONFIG: BubbleMenuConfig;
469
536
  declare const DEFAULT_IMAGE_BUBBLE_MENU_CONFIG: ImageBubbleMenuConfig;
537
+ declare const DEFAULT_TABLE_MENU_CONFIG: TableBubbleMenuConfig;
538
+ declare const DEFAULT_CELL_MENU_CONFIG: CellBubbleMenuConfig$1;
470
539
  declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
471
540
  content: _angular_core.InputSignal<string>;
472
541
  placeholder: _angular_core.InputSignal<string>;
@@ -503,16 +572,29 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
503
572
  }>;
504
573
  editorElement: _angular_core.Signal<ElementRef<any>>;
505
574
  editor: _angular_core.WritableSignal<Editor | null>;
506
- characterCountData: _angular_core.WritableSignal<{
507
- characters: number;
508
- words: number;
509
- } | null>;
575
+ characterCount: _angular_core.WritableSignal<number>;
576
+ wordCount: _angular_core.WritableSignal<number>;
510
577
  isDragOver: _angular_core.WritableSignal<boolean>;
511
578
  editorFullyInitialized: _angular_core.WritableSignal<boolean>;
512
579
  isEditorReady: _angular_core.Signal<boolean>;
513
580
  toolbarConfig: _angular_core.Signal<ToolbarConfig>;
514
581
  bubbleMenuConfig: _angular_core.Signal<BubbleMenuConfig>;
515
582
  imageBubbleMenuConfig: _angular_core.Signal<ImageBubbleMenuConfig>;
583
+ tableBubbleMenuConfig: _angular_core.Signal<{
584
+ addRowBefore: boolean;
585
+ addRowAfter: boolean;
586
+ deleteRow: boolean;
587
+ addColumnBefore: boolean;
588
+ addColumnAfter: boolean;
589
+ deleteColumn: boolean;
590
+ deleteTable: boolean;
591
+ toggleHeaderRow: boolean;
592
+ toggleHeaderColumn: boolean;
593
+ }>;
594
+ cellBubbleMenuConfig: _angular_core.Signal<{
595
+ mergeCells: boolean;
596
+ splitCell: boolean;
597
+ }>;
516
598
  imageUploadConfig: _angular_core.Signal<{
517
599
  maxSize: number;
518
600
  maxWidth: number;
@@ -547,8 +629,6 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
547
629
  focus(): void;
548
630
  blur(): void;
549
631
  clearContent(): void;
550
- private normalizeHTML;
551
- private checkInitialFormValue;
552
632
  private setupFormControlSubscription;
553
633
  setDisabledState(isDisabled: boolean): void;
554
634
  onEditorClick(event: MouseEvent): void;
@@ -567,5 +647,5 @@ type HeightConfig = {
567
647
  maxHeight?: number;
568
648
  };
569
649
 
570
- export { AngularTiptapEditorComponent, DEFAULT_BUBBLE_MENU_CONFIG, DEFAULT_IMAGE_BUBBLE_MENU_CONFIG, DEFAULT_SLASH_COMMANDS, DEFAULT_TOOLBAR_CONFIG, NoopValueAccessorDirective, TiptapI18nService, createI18nSlashCommands };
571
- export type { BubbleMenuConfig, HeightConfig, ImageBubbleMenuConfig, SlashCommandItem, SlashCommandsConfig, SupportedLocale, TiptapTranslations, ToolbarConfig };
650
+ 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, NoopValueAccessorDirective, TiptapI18nService, createI18nSlashCommands };
651
+ export type { BubbleMenuConfig, CellBubbleMenuConfig, HeightConfig, ImageBubbleMenuConfig, SlashCommandItem, SlashCommandsConfig, SupportedLocale, TableBubbleMenuConfig, TiptapTranslations, ToolbarConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flogeez/angular-tiptap-editor",
3
- "version": "0.2.6",
4
- "description": "A modern, customizable rich-text editor for Angular (19+), built with Tiptap and featuring complete internationalization support",
3
+ "version": "0.3.1",
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",
7
7
  "tiptap",
@@ -38,6 +38,11 @@
38
38
  "@tiptap/extension-text-align": "^2.0.0",
39
39
  "@tiptap/extension-link": "^2.0.0",
40
40
  "@tiptap/extension-highlight": "^2.0.0",
41
+ "@tiptap/extension-image": "^2.0.0",
42
+ "@tiptap/extension-table": "^2.0.0",
43
+ "@tiptap/extension-table-cell": "^2.0.0",
44
+ "@tiptap/extension-table-header": "^2.0.0",
45
+ "@tiptap/extension-table-row": "^2.0.0",
41
46
  "@intevation/tiptap-extension-office-paste": "^0.1.0",
42
47
  "tippy.js": "^6.3.7"
43
48
  },
@@ -1,4 +1,14 @@
1
1
  /* Styles globaux pour les menus contextuels Tiptap */
2
+ .tippy-box {
3
+ /* Par défaut Tippy limite à 350px */
4
+ max-width: none !important;
5
+ }
6
+
7
+ .tippy-content {
8
+ /* Le container interne ne doit pas rajouter de padding, on gère dans .bubble-menu */
9
+ padding: 0;
10
+ }
11
+
2
12
  .tippy-box .bubble-menu {
3
13
  display: flex;
4
14
  align-items: center;
@@ -11,6 +21,8 @@
11
21
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
12
22
  z-index: 1000;
13
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
+ white-space: nowrap;
14
26
  }
15
27
 
16
28
  .bubble-menu .tiptap-separator {