@flogeez/angular-tiptap-editor 2.0.2 → 2.1.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/CHANGELOG.md +268 -250
- package/LICENSE +21 -21
- package/README.md +805 -744
- package/fesm2022/flogeez-angular-tiptap-editor.mjs +1943 -1800
- package/fesm2022/flogeez-angular-tiptap-editor.mjs.map +1 -1
- package/index.d.ts +291 -167
- package/package.json +1 -1
- package/src/lib/styles/bubble-menu.global.css +52 -52
- package/src/lib/styles/index.css +40 -40
- package/src/lib/styles/material-symbols.css +17 -17
package/index.d.ts
CHANGED
|
@@ -158,6 +158,8 @@ interface TiptapTranslations {
|
|
|
158
158
|
linkPrompt: string;
|
|
159
159
|
linkUrlPrompt: string;
|
|
160
160
|
confirmDelete: string;
|
|
161
|
+
toggleEdit: string;
|
|
162
|
+
viewMode: string;
|
|
161
163
|
};
|
|
162
164
|
common: {
|
|
163
165
|
cancel: string;
|
|
@@ -330,6 +332,8 @@ declare class TiptapI18nService {
|
|
|
330
332
|
linkPrompt: string;
|
|
331
333
|
linkUrlPrompt: string;
|
|
332
334
|
confirmDelete: string;
|
|
335
|
+
toggleEdit: string;
|
|
336
|
+
viewMode: string;
|
|
333
337
|
}>;
|
|
334
338
|
readonly common: _angular_core.Signal<{
|
|
335
339
|
cancel: string;
|
|
@@ -406,151 +410,6 @@ interface CustomSlashCommands {
|
|
|
406
410
|
commands?: SlashCommandItem[];
|
|
407
411
|
}
|
|
408
412
|
|
|
409
|
-
interface ImageData {
|
|
410
|
-
src: string;
|
|
411
|
-
alt?: string;
|
|
412
|
-
title?: string;
|
|
413
|
-
width?: number;
|
|
414
|
-
height?: number;
|
|
415
|
-
}
|
|
416
|
-
interface ImageUploadResult {
|
|
417
|
-
src: string;
|
|
418
|
-
name: string;
|
|
419
|
-
size: number;
|
|
420
|
-
type: string;
|
|
421
|
-
width?: number;
|
|
422
|
-
height?: number;
|
|
423
|
-
originalSize?: number;
|
|
424
|
-
}
|
|
425
|
-
interface ResizeOptions {
|
|
426
|
-
width?: number;
|
|
427
|
-
height?: number;
|
|
428
|
-
maintainAspectRatio?: boolean;
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Context passed to the image upload handler containing information about the image
|
|
432
|
-
*/
|
|
433
|
-
interface ImageUploadContext {
|
|
434
|
-
/** Original file being uploaded */
|
|
435
|
-
file: File;
|
|
436
|
-
/** Width of the processed image */
|
|
437
|
-
width: number;
|
|
438
|
-
/** Height of the processed image */
|
|
439
|
-
height: number;
|
|
440
|
-
/** MIME type of the image */
|
|
441
|
-
type: string;
|
|
442
|
-
/** Base64 data URL of the processed image (after compression/resize) */
|
|
443
|
-
base64: string;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Result expected from a custom image upload handler.
|
|
447
|
-
* Must contain at least the `src` property with the image URL.
|
|
448
|
-
*/
|
|
449
|
-
interface ImageUploadHandlerResult {
|
|
450
|
-
/** URL of the uploaded image (can be a remote URL or any string) */
|
|
451
|
-
src: string;
|
|
452
|
-
/** Optional custom alt text */
|
|
453
|
-
alt?: string;
|
|
454
|
-
/** Optional custom title */
|
|
455
|
-
title?: string;
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Custom handler function for image uploads.
|
|
459
|
-
* Allows users to implement their own image storage logic (e.g., upload to S3, Cloudinary, etc.)
|
|
460
|
-
*
|
|
461
|
-
* Can return either a Promise or an Observable (Angular-friendly).
|
|
462
|
-
*
|
|
463
|
-
* @param context - Context containing the image file and metadata
|
|
464
|
-
* @returns Promise or Observable resolving to ImageUploadHandlerResult
|
|
465
|
-
*
|
|
466
|
-
* @example Using Promise (async/await)
|
|
467
|
-
* ```typescript
|
|
468
|
-
* uploadHandler: ImageUploadHandler = async (ctx) => {
|
|
469
|
-
* const formData = new FormData();
|
|
470
|
-
* formData.append('image', ctx.file);
|
|
471
|
-
* const result = await firstValueFrom(this.http.post<{url: string}>('/api/upload', formData));
|
|
472
|
-
* return { src: result.url };
|
|
473
|
-
* };
|
|
474
|
-
* ```
|
|
475
|
-
*
|
|
476
|
-
* @example Using Observable (Angular HttpClient)
|
|
477
|
-
* ```typescript
|
|
478
|
-
* uploadHandler: ImageUploadHandler = (ctx) => {
|
|
479
|
-
* const formData = new FormData();
|
|
480
|
-
* formData.append('image', ctx.file);
|
|
481
|
-
* return this.http.post<{url: string}>('/api/upload', formData).pipe(
|
|
482
|
-
* map(result => ({ src: result.url }))
|
|
483
|
-
* );
|
|
484
|
-
* };
|
|
485
|
-
* ```
|
|
486
|
-
*/
|
|
487
|
-
type ImageUploadHandler = (context: ImageUploadContext) => Promise<ImageUploadHandlerResult> | Observable<ImageUploadHandlerResult>;
|
|
488
|
-
declare class ImageService {
|
|
489
|
-
/** Signals for image state */
|
|
490
|
-
selectedImage: _angular_core.WritableSignal<ImageData | null>;
|
|
491
|
-
isImageSelected: _angular_core.Signal<boolean>;
|
|
492
|
-
/** Resizing state */
|
|
493
|
-
isResizing: _angular_core.WritableSignal<boolean>;
|
|
494
|
-
private i18n;
|
|
495
|
-
private readonly t;
|
|
496
|
-
/** Upload state signals */
|
|
497
|
-
isUploading: _angular_core.WritableSignal<boolean>;
|
|
498
|
-
uploadProgress: _angular_core.WritableSignal<number>;
|
|
499
|
-
uploadMessage: _angular_core.WritableSignal<string>;
|
|
500
|
-
/**
|
|
501
|
-
* Custom upload handler.
|
|
502
|
-
* If set, this handler replaces the default base64 conversion.
|
|
503
|
-
*/
|
|
504
|
-
uploadHandler: ImageUploadHandler | null;
|
|
505
|
-
private currentEditor;
|
|
506
|
-
/** Select and track an image from the editor */
|
|
507
|
-
selectImage(editor: Editor): void;
|
|
508
|
-
clearSelection(): void;
|
|
509
|
-
/** Insert a new image and ensure it's selected */
|
|
510
|
-
insertImage(editor: Editor, imageData: ImageData): void;
|
|
511
|
-
/** Update attributes of the currently active image */
|
|
512
|
-
updateImageAttributes(editor: Editor, attributes: Partial<ImageData>): void;
|
|
513
|
-
/** Resize image with optional aspect ratio maintenance */
|
|
514
|
-
resizeImage(editor: Editor, options: ResizeOptions): void;
|
|
515
|
-
/** Predetermined resize helpers used by UI */
|
|
516
|
-
resizeImageToSmall(editor: Editor): void;
|
|
517
|
-
resizeImageToMedium(editor: Editor): void;
|
|
518
|
-
resizeImageToLarge(editor: Editor): void;
|
|
519
|
-
resizeImageToOriginal(editor: Editor): void;
|
|
520
|
-
/** Get current image dimensions */
|
|
521
|
-
getImageDimensions(editor: Editor): {
|
|
522
|
-
width: number;
|
|
523
|
-
height: number;
|
|
524
|
-
} | null;
|
|
525
|
-
/** Remove the selected image */
|
|
526
|
-
deleteImage(editor: Editor): void;
|
|
527
|
-
private updateSelectedImage;
|
|
528
|
-
/** Validate file type and size */
|
|
529
|
-
validateImage(file: File, maxSize?: number): {
|
|
530
|
-
valid: boolean;
|
|
531
|
-
error?: string;
|
|
532
|
-
};
|
|
533
|
-
/** Compress and process image on client side */
|
|
534
|
-
compressImage(file: File, quality?: number, maxWidth?: number, maxHeight?: number): Promise<ImageUploadResult>;
|
|
535
|
-
/** Core upload logic with progress tracking */
|
|
536
|
-
private uploadImageWithProgress;
|
|
537
|
-
private resetUploadState;
|
|
538
|
-
/** Main entry point for file upload and insertion */
|
|
539
|
-
uploadAndInsertImage(editor: Editor, file: File, options?: Record<string, any>): Promise<void>;
|
|
540
|
-
/** Trigger an editor transaction to force decoration update */
|
|
541
|
-
private forceEditorUpdate;
|
|
542
|
-
/** Generic helper to open file picker and process selection */
|
|
543
|
-
private selectFileAndProcess;
|
|
544
|
-
/** Select file and upload as new image */
|
|
545
|
-
selectAndUploadImage(editor: Editor, options?: Record<string, any>): Promise<void>;
|
|
546
|
-
/** Select file and replace currently selected image */
|
|
547
|
-
selectAndReplaceImage(editor: Editor, options?: Record<string, any>): Promise<void>;
|
|
548
|
-
/** Internal helper used by replacement logic */
|
|
549
|
-
uploadAndReplaceImage(editor: Editor, file: File, options?: Record<string, any>): Promise<void>;
|
|
550
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ImageService, never>;
|
|
551
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ImageService>;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
413
|
type StateCalculator = (editor: Editor) => Partial<{
|
|
555
414
|
[K in keyof EditorStateSnapshot]: EditorStateSnapshot[K] extends object ? Partial<EditorStateSnapshot[K]> : EditorStateSnapshot[K];
|
|
556
415
|
}>;
|
|
@@ -660,6 +519,110 @@ interface EditorStateSnapshot {
|
|
|
660
519
|
}
|
|
661
520
|
declare const INITIAL_EDITOR_STATE: EditorStateSnapshot;
|
|
662
521
|
|
|
522
|
+
interface ImageData {
|
|
523
|
+
src: string;
|
|
524
|
+
alt?: string;
|
|
525
|
+
title?: string;
|
|
526
|
+
width?: number;
|
|
527
|
+
height?: number;
|
|
528
|
+
}
|
|
529
|
+
interface ImageUploadResult {
|
|
530
|
+
src: string;
|
|
531
|
+
name: string;
|
|
532
|
+
size: number;
|
|
533
|
+
type: string;
|
|
534
|
+
width?: number;
|
|
535
|
+
height?: number;
|
|
536
|
+
originalSize?: number;
|
|
537
|
+
}
|
|
538
|
+
interface ResizeOptions {
|
|
539
|
+
width?: number;
|
|
540
|
+
height?: number;
|
|
541
|
+
maintainAspectRatio?: boolean;
|
|
542
|
+
}
|
|
543
|
+
interface ImageUploadOptions {
|
|
544
|
+
quality?: number;
|
|
545
|
+
maxWidth?: number;
|
|
546
|
+
maxHeight?: number;
|
|
547
|
+
maxSize?: number;
|
|
548
|
+
allowedTypes?: string[];
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Context passed to the image upload handler containing information about the image
|
|
552
|
+
*/
|
|
553
|
+
interface ImageUploadContext {
|
|
554
|
+
/** Original file being uploaded */
|
|
555
|
+
file: File;
|
|
556
|
+
/** Width of the processed image */
|
|
557
|
+
width: number;
|
|
558
|
+
/** Height of the processed image */
|
|
559
|
+
height: number;
|
|
560
|
+
/** MIME type of the image */
|
|
561
|
+
type: string;
|
|
562
|
+
/** Base64 data URL of the processed image (after compression/resize) */
|
|
563
|
+
base64: string;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Result expected from a custom image upload handler.
|
|
567
|
+
* Must contain at least the `src` property with the image URL.
|
|
568
|
+
*/
|
|
569
|
+
interface ImageUploadHandlerResult {
|
|
570
|
+
/** URL of the uploaded image (can be a remote URL or any string) */
|
|
571
|
+
src: string;
|
|
572
|
+
/** Optional custom alt text */
|
|
573
|
+
alt?: string;
|
|
574
|
+
/** Optional custom title */
|
|
575
|
+
title?: string;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Custom handler function for image uploads.
|
|
579
|
+
* Allows users to implement their own image storage logic (e.g., upload to S3, Cloudinary, etc.)
|
|
580
|
+
*
|
|
581
|
+
* Can return either a Promise or an Observable (Angular-friendly).
|
|
582
|
+
*
|
|
583
|
+
* @param context - Context containing the image file and metadata
|
|
584
|
+
* @returns Promise or Observable resolving to ImageUploadHandlerResult
|
|
585
|
+
*
|
|
586
|
+
* @example Using Promise (async/await)
|
|
587
|
+
* ```typescript
|
|
588
|
+
* uploadHandler: ImageUploadHandler = async (ctx) => {
|
|
589
|
+
* const formData = new FormData();
|
|
590
|
+
* formData.append('image', ctx.file);
|
|
591
|
+
* const result = await firstValueFrom(this.http.post<{url: string}>('/api/upload', formData));
|
|
592
|
+
* return { src: result.url };
|
|
593
|
+
* };
|
|
594
|
+
* ```
|
|
595
|
+
*
|
|
596
|
+
* @example Using Observable (Angular HttpClient)
|
|
597
|
+
* ```typescript
|
|
598
|
+
* uploadHandler: ImageUploadHandler = (ctx) => {
|
|
599
|
+
* const formData = new FormData();
|
|
600
|
+
* formData.append('image', ctx.file);
|
|
601
|
+
* return this.http.post<{url: string}>('/api/upload', formData).pipe(
|
|
602
|
+
* map(result => ({ src: result.url }))
|
|
603
|
+
* );
|
|
604
|
+
* };
|
|
605
|
+
* ```
|
|
606
|
+
*/
|
|
607
|
+
type ImageUploadHandler = (context: ImageUploadContext) => Promise<ImageUploadHandlerResult> | Observable<ImageUploadHandlerResult>;
|
|
608
|
+
/**
|
|
609
|
+
* Interface dedicated to image upload configuration.
|
|
610
|
+
*/
|
|
611
|
+
interface AteImageUploadConfig {
|
|
612
|
+
/** Callback function to handle upload (Promise or Observable) */
|
|
613
|
+
handler?: ImageUploadHandler;
|
|
614
|
+
/** Compression quality (0 to 1) */
|
|
615
|
+
quality?: number;
|
|
616
|
+
/** Maximum allowed width in pixels */
|
|
617
|
+
maxWidth?: number;
|
|
618
|
+
/** Maximum allowed height in pixels */
|
|
619
|
+
maxHeight?: number;
|
|
620
|
+
/** Maximum allowed size in MB */
|
|
621
|
+
maxSize?: number;
|
|
622
|
+
/** Accepted file types (e.g., ['image/jpeg', 'image/png']) */
|
|
623
|
+
allowedTypes?: string[];
|
|
624
|
+
}
|
|
625
|
+
|
|
663
626
|
declare class EditorCommandsService {
|
|
664
627
|
private imageService;
|
|
665
628
|
private colorPickerSvc;
|
|
@@ -723,17 +686,8 @@ declare class EditorCommandsService {
|
|
|
723
686
|
setContent(editor: Editor, content: string, emitUpdate?: boolean): void;
|
|
724
687
|
setEditable(editor: Editor, editable: boolean): void;
|
|
725
688
|
insertContent(editor: Editor, content: string): void;
|
|
726
|
-
insertImage(editor: Editor, options?:
|
|
727
|
-
|
|
728
|
-
maxWidth?: number;
|
|
729
|
-
maxHeight?: number;
|
|
730
|
-
accept?: string;
|
|
731
|
-
}): Promise<void>;
|
|
732
|
-
uploadImage(editor: Editor, file: File, options?: {
|
|
733
|
-
quality?: number;
|
|
734
|
-
maxWidth?: number;
|
|
735
|
-
maxHeight?: number;
|
|
736
|
-
}): Promise<void>;
|
|
689
|
+
insertImage(editor: Editor, options?: ImageUploadOptions): Promise<void>;
|
|
690
|
+
uploadImage(editor: Editor, file: File, options?: ImageUploadOptions): Promise<void>;
|
|
737
691
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EditorCommandsService, never>;
|
|
738
692
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<EditorCommandsService>;
|
|
739
693
|
}
|
|
@@ -849,6 +803,77 @@ interface CellBubbleMenuConfig {
|
|
|
849
803
|
splitCell?: boolean;
|
|
850
804
|
}
|
|
851
805
|
|
|
806
|
+
/**
|
|
807
|
+
* Global configuration interface for Angular Tiptap Editor.
|
|
808
|
+
* Uses a flat structure for common settings and objects for complex configurations.
|
|
809
|
+
*/
|
|
810
|
+
interface AteEditorConfig {
|
|
811
|
+
/** Editor theme: light, dark, or system auto-detection */
|
|
812
|
+
theme?: "light" | "dark" | "auto";
|
|
813
|
+
/** Display mode: classic or seamless (no borders/background) */
|
|
814
|
+
mode?: "classic" | "seamless";
|
|
815
|
+
/** Editor height (e.g., '300px', 'auto') */
|
|
816
|
+
height?: string;
|
|
817
|
+
/** Focus position on initialization */
|
|
818
|
+
autofocus?: "start" | "end" | "all" | boolean | number;
|
|
819
|
+
/** Placeholder text displayed when the editor is empty */
|
|
820
|
+
placeholder?: string;
|
|
821
|
+
/** Initial editing state (if false, the editor is read-only) */
|
|
822
|
+
editable?: boolean;
|
|
823
|
+
/** Minimum editor height (e.g., '200px') */
|
|
824
|
+
minHeight?: string;
|
|
825
|
+
/** Maximum editor height (e.g., '500px') */
|
|
826
|
+
maxHeight?: string;
|
|
827
|
+
/** If true, the editor takes 100% of the parent container's height */
|
|
828
|
+
fillContainer?: boolean;
|
|
829
|
+
/** Disabled state (often used with forms) */
|
|
830
|
+
disabled?: boolean;
|
|
831
|
+
/** Editor locale (overrides the global i18n service) */
|
|
832
|
+
locale?: string;
|
|
833
|
+
/** Enable browser spellcheck */
|
|
834
|
+
spellcheck?: boolean;
|
|
835
|
+
/** Enable smart cleanup when pasting from Office/Word */
|
|
836
|
+
enableOfficePaste?: boolean;
|
|
837
|
+
/** Show or hide the toolbar */
|
|
838
|
+
showToolbar?: boolean;
|
|
839
|
+
/** Show or hide the footer (counters area) */
|
|
840
|
+
showFooter?: boolean;
|
|
841
|
+
/** Show or hide the character count */
|
|
842
|
+
showCharacterCount?: boolean;
|
|
843
|
+
/** Show or hide the word count */
|
|
844
|
+
showWordCount?: boolean;
|
|
845
|
+
/** Show or hide the read-only/edit toggle button */
|
|
846
|
+
showEditToggle?: boolean;
|
|
847
|
+
/** Show or hide the text context menu */
|
|
848
|
+
showBubbleMenu?: boolean;
|
|
849
|
+
/** Show or hide the image context menu */
|
|
850
|
+
showImageBubbleMenu?: boolean;
|
|
851
|
+
/** Show or hide the table menu */
|
|
852
|
+
showTableMenu?: boolean;
|
|
853
|
+
/** Show or hide the cell menu */
|
|
854
|
+
showCellMenu?: boolean;
|
|
855
|
+
/** Enable or disable slash commands (/) */
|
|
856
|
+
enableSlashCommands?: boolean;
|
|
857
|
+
/** Maximum number of characters allowed */
|
|
858
|
+
maxCharacters?: number;
|
|
859
|
+
/** Detailed toolbar configuration (items, groups) */
|
|
860
|
+
toolbar?: ToolbarConfig;
|
|
861
|
+
/** Text context menu configuration */
|
|
862
|
+
bubbleMenu?: BubbleMenuConfig;
|
|
863
|
+
/** Image context menu configuration */
|
|
864
|
+
imageBubbleMenu?: ImageBubbleMenuConfig;
|
|
865
|
+
/** Table context menu configuration */
|
|
866
|
+
tableBubbleMenu?: TableBubbleMenuConfig;
|
|
867
|
+
/** Cell context menu configuration */
|
|
868
|
+
cellBubbleMenu?: CellBubbleMenuConfig;
|
|
869
|
+
/** Slash commands configuration (/) */
|
|
870
|
+
slashCommands?: SlashCommandsConfig;
|
|
871
|
+
/** If true, shows the floating toolbar on focus */
|
|
872
|
+
floatingToolbar?: boolean;
|
|
873
|
+
/** Technical configuration for image uploads */
|
|
874
|
+
imageUpload?: AteImageUploadConfig;
|
|
875
|
+
}
|
|
876
|
+
|
|
852
877
|
declare class NoopValueAccessorDirective implements ControlValueAccessor {
|
|
853
878
|
writeValue(obj: any): void;
|
|
854
879
|
registerOnChange(fn: any): void;
|
|
@@ -858,6 +883,8 @@ declare class NoopValueAccessorDirective implements ControlValueAccessor {
|
|
|
858
883
|
}
|
|
859
884
|
|
|
860
885
|
declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
886
|
+
/** Configuration globale de l'éditeur */
|
|
887
|
+
config: _angular_core.InputSignal<AteEditorConfig>;
|
|
861
888
|
content: _angular_core.InputSignal<string>;
|
|
862
889
|
placeholder: _angular_core.InputSignal<string>;
|
|
863
890
|
editable: _angular_core.InputSignal<boolean>;
|
|
@@ -879,6 +906,8 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
|
879
906
|
autofocus: _angular_core.InputSignal<number | boolean | "start" | "end" | "all">;
|
|
880
907
|
seamless: _angular_core.InputSignal<boolean>;
|
|
881
908
|
floatingToolbar: _angular_core.InputSignal<boolean>;
|
|
909
|
+
showEditToggle: _angular_core.InputSignal<boolean>;
|
|
910
|
+
spellcheck: _angular_core.InputSignal<boolean>;
|
|
882
911
|
tiptapExtensions: _angular_core.InputSignal<(Node<any, any> | Mark<any, any> | Extension<any, any>)[]>;
|
|
883
912
|
tiptapOptions: _angular_core.InputSignal<Partial<EditorOptions>>;
|
|
884
913
|
showBubbleMenu: _angular_core.InputSignal<boolean>;
|
|
@@ -894,7 +923,7 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
|
894
923
|
* Additionnal state calculators to extend the reactive editor state.
|
|
895
924
|
*/
|
|
896
925
|
stateCalculators: _angular_core.InputSignal<StateCalculator[]>;
|
|
897
|
-
imageUpload: _angular_core.InputSignal<Partial<
|
|
926
|
+
imageUpload: _angular_core.InputSignal<Partial<ImageUploadOptions>>;
|
|
898
927
|
/**
|
|
899
928
|
* Custom handler for image uploads.
|
|
900
929
|
* When provided, images will be processed through this handler instead of being converted to base64.
|
|
@@ -929,6 +958,7 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
|
929
958
|
editor: Editor;
|
|
930
959
|
event: FocusEvent;
|
|
931
960
|
}>;
|
|
961
|
+
editableChange: _angular_core.OutputEmitterRef<boolean>;
|
|
932
962
|
editorElement: _angular_core.Signal<ElementRef<any>>;
|
|
933
963
|
hideBubbleMenus(): void;
|
|
934
964
|
showBubbleMenus(): void;
|
|
@@ -947,13 +977,38 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
|
947
977
|
readonly isFormControlDisabled: _angular_core.Signal<boolean>;
|
|
948
978
|
readonly mergedDisabled: _angular_core.Signal<boolean>;
|
|
949
979
|
isEditorReady: _angular_core.Signal<boolean>;
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
980
|
+
readonly finalSeamless: _angular_core.Signal<boolean>;
|
|
981
|
+
readonly finalPlaceholder: _angular_core.Signal<string>;
|
|
982
|
+
readonly finalFillContainer: _angular_core.Signal<boolean>;
|
|
983
|
+
readonly finalShowFooter: _angular_core.Signal<boolean>;
|
|
984
|
+
readonly finalShowEditToggle: _angular_core.Signal<boolean>;
|
|
985
|
+
readonly finalHeight: _angular_core.Signal<string | undefined>;
|
|
986
|
+
readonly finalMinHeight: _angular_core.Signal<string | undefined>;
|
|
987
|
+
readonly finalMaxHeight: _angular_core.Signal<string | undefined>;
|
|
988
|
+
readonly finalSpellcheck: _angular_core.Signal<boolean>;
|
|
989
|
+
readonly finalEnableOfficePaste: _angular_core.Signal<boolean>;
|
|
990
|
+
readonly finalShowToolbar: _angular_core.Signal<boolean>;
|
|
991
|
+
readonly finalToolbarConfig: _angular_core.Signal<ToolbarConfig>;
|
|
992
|
+
readonly finalFloatingToolbar: _angular_core.Signal<boolean>;
|
|
993
|
+
readonly finalShowBubbleMenu: _angular_core.Signal<boolean>;
|
|
994
|
+
readonly finalBubbleMenuConfig: _angular_core.Signal<BubbleMenuConfig>;
|
|
995
|
+
readonly finalShowImageBubbleMenu: _angular_core.Signal<boolean>;
|
|
996
|
+
readonly finalImageBubbleMenuConfig: _angular_core.Signal<ImageBubbleMenuConfig>;
|
|
997
|
+
readonly finalShowTableBubbleMenu: _angular_core.Signal<boolean>;
|
|
998
|
+
readonly finalTableBubbleMenuConfig: _angular_core.Signal<TableBubbleMenuConfig>;
|
|
999
|
+
readonly finalShowCellBubbleMenu: _angular_core.Signal<boolean>;
|
|
1000
|
+
readonly finalCellBubbleMenuConfig: _angular_core.Signal<CellBubbleMenuConfig>;
|
|
1001
|
+
readonly finalEnableSlashCommands: _angular_core.Signal<boolean>;
|
|
1002
|
+
readonly finalSlashCommandsConfig: _angular_core.Signal<CustomSlashCommands>;
|
|
1003
|
+
readonly finalAutofocus: _angular_core.Signal<number | boolean | "start" | "end" | "all">;
|
|
1004
|
+
readonly finalMaxCharacters: _angular_core.Signal<number | undefined>;
|
|
1005
|
+
readonly finalShowCharacterCount: _angular_core.Signal<boolean>;
|
|
1006
|
+
readonly finalShowWordCount: _angular_core.Signal<boolean>;
|
|
1007
|
+
readonly finalLocale: _angular_core.Signal<SupportedLocale>;
|
|
1008
|
+
readonly finalImageUploadConfig: _angular_core.Signal<{
|
|
956
1009
|
maxSize: number;
|
|
1010
|
+
handler?: ImageUploadHandler;
|
|
1011
|
+
quality: number;
|
|
957
1012
|
maxWidth: number;
|
|
958
1013
|
maxHeight: number;
|
|
959
1014
|
allowedTypes: string[];
|
|
@@ -961,9 +1016,8 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
|
961
1016
|
showPreview: boolean;
|
|
962
1017
|
multiple: boolean;
|
|
963
1018
|
compressImages: boolean;
|
|
964
|
-
quality: number;
|
|
965
1019
|
}>;
|
|
966
|
-
|
|
1020
|
+
readonly finalImageUploadHandler: _angular_core.Signal<ImageUploadHandler | undefined>;
|
|
967
1021
|
readonly currentTranslations: _angular_core.Signal<_flogeez_angular_tiptap_editor.TiptapTranslations>;
|
|
968
1022
|
private _destroyRef;
|
|
969
1023
|
private ngControl;
|
|
@@ -974,6 +1028,7 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
|
974
1028
|
ngAfterViewInit(): void;
|
|
975
1029
|
ngOnDestroy(): void;
|
|
976
1030
|
private initEditor;
|
|
1031
|
+
toggleEditMode(event: Event): void;
|
|
977
1032
|
private updateCharacterCount;
|
|
978
1033
|
onDragOver(event: DragEvent): void;
|
|
979
1034
|
onDrop(event: DragEvent): void;
|
|
@@ -989,7 +1044,76 @@ declare class AngularTiptapEditorComponent implements AfterViewInit, OnDestroy {
|
|
|
989
1044
|
private setupFormControlSubscription;
|
|
990
1045
|
onEditorClick(event: MouseEvent): void;
|
|
991
1046
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AngularTiptapEditorComponent, never>;
|
|
992
|
-
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; }; "disabled": { "alias": "disabled"; "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; }; "showFooter": { "alias": "showFooter"; "required": false; "isSignal": true; }; "showCharacterCount": { "alias": "showCharacterCount"; "required": false; "isSignal": true; }; "showWordCount": { "alias": "showWordCount"; "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; }; "seamless": { "alias": "seamless"; "required": false; "isSignal": true; }; "floatingToolbar": { "alias": "floatingToolbar"; "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; }; "showTableBubbleMenu": { "alias": "showTableBubbleMenu"; "required": false; "isSignal": true; }; "tableBubbleMenu": { "alias": "tableBubbleMenu"; "required": false; "isSignal": true; }; "showCellBubbleMenu": { "alias": "showCellBubbleMenu"; "required": false; "isSignal": true; }; "cellBubbleMenu": { "alias": "cellBubbleMenu"; "required": false; "isSignal": true; }; "stateCalculators": { "alias": "stateCalculators"; "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: {}; }]>;
|
|
1047
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AngularTiptapEditorComponent, "angular-tiptap-editor", never, { "config": { "alias": "config"; "required": false; "isSignal": true; }; "content": { "alias": "content"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "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; }; "showFooter": { "alias": "showFooter"; "required": false; "isSignal": true; }; "showCharacterCount": { "alias": "showCharacterCount"; "required": false; "isSignal": true; }; "showWordCount": { "alias": "showWordCount"; "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; }; "seamless": { "alias": "seamless"; "required": false; "isSignal": true; }; "floatingToolbar": { "alias": "floatingToolbar"; "required": false; "isSignal": true; }; "showEditToggle": { "alias": "showEditToggle"; "required": false; "isSignal": true; }; "spellcheck": { "alias": "spellcheck"; "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; }; "showTableBubbleMenu": { "alias": "showTableBubbleMenu"; "required": false; "isSignal": true; }; "tableBubbleMenu": { "alias": "tableBubbleMenu"; "required": false; "isSignal": true; }; "showCellBubbleMenu": { "alias": "showCellBubbleMenu"; "required": false; "isSignal": true; }; "cellBubbleMenu": { "alias": "cellBubbleMenu"; "required": false; "isSignal": true; }; "stateCalculators": { "alias": "stateCalculators"; "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"; "editableChange": "editableChange"; }, never, never, true, [{ directive: typeof NoopValueAccessorDirective; inputs: {}; outputs: {}; }]>;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
declare class ImageService {
|
|
1051
|
+
/** Signals for image state */
|
|
1052
|
+
selectedImage: _angular_core.WritableSignal<ImageData | null>;
|
|
1053
|
+
isImageSelected: _angular_core.Signal<boolean>;
|
|
1054
|
+
/** Resizing state */
|
|
1055
|
+
isResizing: _angular_core.WritableSignal<boolean>;
|
|
1056
|
+
private i18n;
|
|
1057
|
+
private readonly t;
|
|
1058
|
+
/** Upload state signals */
|
|
1059
|
+
isUploading: _angular_core.WritableSignal<boolean>;
|
|
1060
|
+
uploadProgress: _angular_core.WritableSignal<number>;
|
|
1061
|
+
uploadMessage: _angular_core.WritableSignal<string>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Custom upload handler.
|
|
1064
|
+
* If set, this handler replaces the default base64 conversion.
|
|
1065
|
+
*/
|
|
1066
|
+
uploadHandler: ImageUploadHandler | null;
|
|
1067
|
+
private currentEditor;
|
|
1068
|
+
/** Select and track an image from the editor */
|
|
1069
|
+
selectImage(editor: Editor): void;
|
|
1070
|
+
clearSelection(): void;
|
|
1071
|
+
/** Insert a new image and ensure it's selected */
|
|
1072
|
+
insertImage(editor: Editor, imageData: ImageData): void;
|
|
1073
|
+
/** Update attributes of the currently active image */
|
|
1074
|
+
updateImageAttributes(editor: Editor, attributes: Partial<ImageData>): void;
|
|
1075
|
+
/** Resize image with optional aspect ratio maintenance */
|
|
1076
|
+
resizeImage(editor: Editor, options: ResizeOptions): void;
|
|
1077
|
+
/** Predetermined resize helpers used by UI */
|
|
1078
|
+
resizeImageToSmall(editor: Editor): void;
|
|
1079
|
+
resizeImageToMedium(editor: Editor): void;
|
|
1080
|
+
resizeImageToLarge(editor: Editor): void;
|
|
1081
|
+
resizeImageToOriginal(editor: Editor): void;
|
|
1082
|
+
/** Get current image dimensions */
|
|
1083
|
+
getImageDimensions(editor: Editor): {
|
|
1084
|
+
width: number;
|
|
1085
|
+
height: number;
|
|
1086
|
+
} | null;
|
|
1087
|
+
/** Remove the selected image */
|
|
1088
|
+
deleteImage(editor: Editor): void;
|
|
1089
|
+
private updateSelectedImage;
|
|
1090
|
+
/** Validate file type and size */
|
|
1091
|
+
validateImage(file: File, options?: {
|
|
1092
|
+
maxSize?: number;
|
|
1093
|
+
allowedTypes?: string[];
|
|
1094
|
+
}): {
|
|
1095
|
+
valid: boolean;
|
|
1096
|
+
error?: string;
|
|
1097
|
+
};
|
|
1098
|
+
/** Compress and process image on client side */
|
|
1099
|
+
compressImage(file: File, quality?: number, maxWidth?: number, maxHeight?: number): Promise<ImageUploadResult>;
|
|
1100
|
+
/** Core upload logic with progress tracking */
|
|
1101
|
+
private uploadImageWithProgress;
|
|
1102
|
+
private resetUploadState;
|
|
1103
|
+
/** Main entry point for file upload and insertion */
|
|
1104
|
+
uploadAndInsertImage(editor: Editor, file: File, options?: ImageUploadOptions): Promise<void>;
|
|
1105
|
+
/** Trigger an editor transaction to force decoration update */
|
|
1106
|
+
private forceEditorUpdate;
|
|
1107
|
+
/** Generic helper to open file picker and process selection */
|
|
1108
|
+
private selectFileAndProcess;
|
|
1109
|
+
/** Select file and upload as new image */
|
|
1110
|
+
selectAndUploadImage(editor: Editor, options?: ImageUploadOptions): Promise<void>;
|
|
1111
|
+
/** Select file and replace currently selected image */
|
|
1112
|
+
selectAndReplaceImage(editor: Editor, options?: ImageUploadOptions): Promise<void>;
|
|
1113
|
+
/** Internal helper used by replacement logic */
|
|
1114
|
+
uploadAndReplaceImage(editor: Editor, file: File, options?: ImageUploadOptions): Promise<void>;
|
|
1115
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ImageService, never>;
|
|
1116
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ImageService>;
|
|
993
1117
|
}
|
|
994
1118
|
|
|
995
1119
|
interface ColorPickerSelection {
|
|
@@ -1121,4 +1245,4 @@ declare const DEFAULT_TABLE_MENU_CONFIG: TableBubbleMenuConfig;
|
|
|
1121
1245
|
declare const DEFAULT_CELL_MENU_CONFIG: CellBubbleMenuConfig;
|
|
1122
1246
|
|
|
1123
1247
|
export { AngularTiptapEditorComponent, ColorPickerService, DEFAULT_BUBBLE_MENU_CONFIG, DEFAULT_CELL_MENU_CONFIG, DEFAULT_IMAGE_BUBBLE_MENU_CONFIG, DEFAULT_SLASH_COMMANDS_CONFIG, DEFAULT_TABLE_MENU_CONFIG, DEFAULT_TOOLBAR_CONFIG, DiscoveryCalculator, EditorCommandsService, INITIAL_EDITOR_STATE, ImageCalculator, ImageService, LinkService, MarksCalculator, NoopValueAccessorDirective, SLASH_COMMAND_KEYS, SelectionCalculator, StructureCalculator, TableCalculator, TiptapI18nService, createDefaultSlashCommands, filterSlashCommands };
|
|
1124
|
-
export type { BubbleMenuConfig, CellBubbleMenuConfig, ColorEditMode, ColorPickerSelection, CustomSlashCommands, EditorStateSnapshot, ImageBubbleMenuConfig, ImageData, ImageUploadContext, ImageUploadHandler, ImageUploadHandlerResult, ImageUploadResult, ResizeOptions, SlashCommandItem, SlashCommandKey, SlashCommandsConfig, StateCalculator, SupportedLocale, TableBubbleMenuConfig, TiptapTranslations, ToolbarConfig };
|
|
1248
|
+
export type { AteEditorConfig, AteImageUploadConfig, BubbleMenuConfig, CellBubbleMenuConfig, ColorEditMode, ColorPickerSelection, CustomSlashCommands, EditorStateSnapshot, ImageBubbleMenuConfig, ImageData, ImageUploadContext, ImageUploadHandler, ImageUploadHandlerResult, ImageUploadOptions, ImageUploadResult, ResizeOptions, SlashCommandItem, SlashCommandKey, SlashCommandsConfig, StateCalculator, SupportedLocale, TableBubbleMenuConfig, TiptapTranslations, ToolbarConfig };
|
package/package.json
CHANGED