@flogeez/angular-tiptap-editor 3.1.3 → 3.1.4

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +2 -2
  3. package/esm2022/flogeez-angular-tiptap-editor.mjs +5 -0
  4. package/esm2022/lib/ate-editor.provider.mjs +38 -0
  5. package/esm2022/lib/components/bubble-menus/base/ate-base-bubble-menu.mjs +207 -0
  6. package/esm2022/lib/components/bubble-menus/base/ate-base-sub-bubble-menu.mjs +137 -0
  7. package/esm2022/lib/components/bubble-menus/color/ate-color-bubble-menu.component.mjs +365 -0
  8. package/esm2022/lib/components/bubble-menus/image/ate-image-bubble-menu.component.mjs +309 -0
  9. package/esm2022/lib/components/bubble-menus/link/ate-link-bubble-menu.component.mjs +247 -0
  10. package/esm2022/lib/components/bubble-menus/table/ate-cell-bubble-menu.component.mjs +126 -0
  11. package/esm2022/lib/components/bubble-menus/table/ate-table-bubble-menu.component.mjs +271 -0
  12. package/esm2022/lib/components/bubble-menus/text/ate-bubble-menu.component.mjs +272 -0
  13. package/esm2022/lib/components/color-picker/ate-color-picker.component.mjs +123 -0
  14. package/esm2022/lib/components/edit-toggle/ate-edit-toggle.component.mjs +42 -0
  15. package/esm2022/lib/components/editor/angular-tiptap-editor.component.mjs +1031 -0
  16. package/esm2022/lib/components/editor/ate-block-controls.component.mjs +256 -0
  17. package/esm2022/lib/components/slash-commands/ate-slash-commands.component.mjs +328 -0
  18. package/esm2022/lib/components/toolbar/ate-toolbar.component.mjs +531 -0
  19. package/esm2022/lib/components/ui/ate-button.component.mjs +91 -0
  20. package/esm2022/lib/components/ui/ate-separator.component.mjs +11 -0
  21. package/esm2022/lib/config/ate-editor.config.mjs +133 -0
  22. package/esm2022/lib/config/ate-global-config.token.mjs +6 -0
  23. package/esm2022/lib/config/ate-slash-commands.config.mjs +130 -0
  24. package/esm2022/lib/directives/ate-noop-value-accessor.directive.mjs +40 -0
  25. package/esm2022/lib/directives/ate-tooltip.directive.mjs +138 -0
  26. package/esm2022/lib/extensions/ate-block-controls.extension.mjs +156 -0
  27. package/esm2022/lib/extensions/ate-link-click-behavior.extension.mjs +32 -0
  28. package/esm2022/lib/extensions/ate-resizable-image.extension.mjs +277 -0
  29. package/esm2022/lib/extensions/ate-table.extension.mjs +27 -0
  30. package/esm2022/lib/extensions/ate-tiptap-state.extension.mjs +85 -0
  31. package/esm2022/lib/extensions/ate-upload-progress.extension.mjs +195 -0
  32. package/esm2022/lib/extensions/calculators/ate-discovery.calculator.mjs +62 -0
  33. package/esm2022/lib/extensions/calculators/ate-image.calculator.mjs +8 -0
  34. package/esm2022/lib/extensions/calculators/ate-marks.calculator.mjs +75 -0
  35. package/esm2022/lib/extensions/calculators/ate-selection.calculator.mjs +35 -0
  36. package/esm2022/lib/extensions/calculators/ate-structure.calculator.mjs +34 -0
  37. package/esm2022/lib/extensions/calculators/ate-table.calculator.mjs +38 -0
  38. package/esm2022/lib/models/ate-bubble-menu.model.mjs +53 -0
  39. package/esm2022/lib/models/ate-editor-config.model.mjs +2 -0
  40. package/esm2022/lib/models/ate-editor-state.model.mjs +90 -0
  41. package/esm2022/lib/models/ate-image.model.mjs +2 -0
  42. package/esm2022/lib/models/ate-slash-command.model.mjs +2 -0
  43. package/esm2022/lib/models/ate-toolbar.model.mjs +35 -0
  44. package/esm2022/lib/node-view/ate-angular-node-view.mjs +97 -0
  45. package/esm2022/lib/node-view/ate-injector.registry.mjs +16 -0
  46. package/esm2022/lib/node-view/ate-node-view.factory.mjs +125 -0
  47. package/esm2022/lib/node-view/ate-node-view.models.mjs +2 -0
  48. package/esm2022/lib/node-view/ate-node-view.renderer.mjs +154 -0
  49. package/esm2022/lib/node-view/ate-register-angular-component.mjs +49 -0
  50. package/esm2022/lib/services/ate-color-picker.service.mjs +194 -0
  51. package/esm2022/lib/services/ate-editor-commands.service.mjs +474 -0
  52. package/esm2022/lib/services/ate-i18n.service.mjs +422 -0
  53. package/esm2022/lib/services/ate-image.service.mjs +459 -0
  54. package/esm2022/lib/services/ate-link.service.mjs +99 -0
  55. package/esm2022/lib/utils/ate-color.utils.mjs +60 -0
  56. package/esm2022/public-api.mjs +40 -0
  57. package/fesm2022/flogeez-angular-tiptap-editor.mjs +319 -352
  58. package/fesm2022/flogeez-angular-tiptap-editor.mjs.map +1 -1
  59. package/index.d.ts +3 -1734
  60. package/lib/ate-editor.provider.d.ts +21 -0
  61. package/lib/components/bubble-menus/base/ate-base-bubble-menu.d.ts +71 -0
  62. package/lib/components/bubble-menus/base/ate-base-sub-bubble-menu.d.ts +60 -0
  63. package/lib/components/bubble-menus/color/ate-color-bubble-menu.component.d.ts +77 -0
  64. package/lib/components/bubble-menus/image/ate-image-bubble-menu.component.d.ts +49 -0
  65. package/lib/components/bubble-menus/link/ate-link-bubble-menu.component.d.ts +55 -0
  66. package/lib/components/bubble-menus/table/ate-cell-bubble-menu.component.d.ts +16 -0
  67. package/lib/components/bubble-menus/table/ate-table-bubble-menu.component.d.ts +25 -0
  68. package/lib/components/bubble-menus/text/ate-bubble-menu.component.d.ts +53 -0
  69. package/lib/components/color-picker/ate-color-picker.component.d.ts +54 -0
  70. package/lib/components/edit-toggle/ate-edit-toggle.component.d.ts +13 -0
  71. package/lib/components/editor/angular-tiptap-editor.component.d.ts +242 -0
  72. package/lib/components/editor/ate-block-controls.component.d.ts +44 -0
  73. package/lib/components/slash-commands/ate-slash-commands.component.d.ts +34 -0
  74. package/lib/components/toolbar/ate-toolbar.component.d.ts +47 -0
  75. package/lib/components/ui/ate-button.component.d.ts +25 -0
  76. package/lib/components/ui/ate-separator.component.d.ts +5 -0
  77. package/lib/config/ate-editor.config.d.ts +19 -0
  78. package/lib/config/ate-global-config.token.d.ts +6 -0
  79. package/lib/config/ate-slash-commands.config.d.ts +41 -0
  80. package/lib/directives/ate-noop-value-accessor.directive.d.ts +13 -0
  81. package/lib/directives/ate-tooltip.directive.d.ts +30 -0
  82. package/lib/extensions/ate-block-controls.extension.d.ts +10 -0
  83. package/lib/extensions/ate-link-click-behavior.extension.d.ts +2 -0
  84. package/lib/extensions/ate-resizable-image.extension.d.ts +27 -0
  85. package/lib/extensions/ate-table.extension.d.ts +2 -0
  86. package/lib/extensions/ate-tiptap-state.extension.d.ts +7 -0
  87. package/lib/extensions/ate-upload-progress.extension.d.ts +7 -0
  88. package/lib/extensions/calculators/ate-discovery.calculator.d.ts +7 -0
  89. package/lib/extensions/calculators/ate-image.calculator.d.ts +2 -0
  90. package/lib/extensions/calculators/ate-marks.calculator.d.ts +2 -0
  91. package/lib/extensions/calculators/ate-selection.calculator.d.ts +2 -0
  92. package/lib/extensions/calculators/ate-structure.calculator.d.ts +2 -0
  93. package/lib/extensions/calculators/ate-table.calculator.d.ts +2 -0
  94. package/lib/models/ate-bubble-menu.model.d.ts +33 -0
  95. package/lib/models/ate-editor-config.model.d.ts +113 -0
  96. package/lib/models/ate-editor-state.model.d.ts +109 -0
  97. package/lib/models/ate-image.model.d.ts +104 -0
  98. package/lib/models/ate-slash-command.model.d.ts +17 -0
  99. package/lib/models/ate-toolbar.model.d.ts +18 -0
  100. package/lib/node-view/ate-angular-node-view.d.ts +115 -0
  101. package/lib/node-view/ate-injector.registry.d.ts +3 -0
  102. package/lib/node-view/ate-node-view.factory.d.ts +10 -0
  103. package/lib/node-view/ate-node-view.models.d.ts +138 -0
  104. package/lib/node-view/ate-node-view.renderer.d.ts +23 -0
  105. package/lib/node-view/ate-register-angular-component.d.ts +35 -0
  106. package/lib/services/ate-color-picker.service.d.ts +65 -0
  107. package/lib/services/ate-editor-commands.service.d.ts +75 -0
  108. package/lib/services/ate-i18n.service.d.ts +406 -0
  109. package/lib/services/ate-image.service.d.ts +82 -0
  110. package/lib/services/ate-link.service.d.ts +42 -0
  111. package/lib/utils/ate-color.utils.d.ts +12 -0
  112. package/package.json +3 -1
  113. package/public-api.d.ts +31 -0
@@ -0,0 +1,23 @@
1
+ import { Type } from "@angular/core";
2
+ import { NodeView, Decoration, EditorView } from "@tiptap/pm/view";
3
+ import { Node as ProseMirrorNode } from "@tiptap/pm/model";
4
+ import { Editor } from "@tiptap/core";
5
+ import { AteComponentRenderOptions } from "./ate-node-view.models";
6
+ /**
7
+ * Universal Renderer for Angular Components as TipTap NodeViews.
8
+ *
9
+ * Supports:
10
+ * - TipTap-Aware components (extending AteAngularNodeView)
11
+ * - Standard library components (automatic @Input() sync)
12
+ * - Signal-based inputs and outputs (Angular 18+)
13
+ * - Content projection (editableContent)
14
+ * - Unified lifecycle and event management
15
+ */
16
+ export declare function AteNodeViewRenderer<T>(component: Type<T>, options: AteComponentRenderOptions): (props: {
17
+ node: ProseMirrorNode;
18
+ view: EditorView;
19
+ getPos: () => number | undefined;
20
+ decorations: readonly Decoration[];
21
+ editor: Editor;
22
+ extension: unknown;
23
+ }) => NodeView;
@@ -0,0 +1,35 @@
1
+ import { Injector } from "@angular/core";
2
+ import { Node } from "@tiptap/core";
3
+ import { RegisterAngularComponentOptions } from "./ate-node-view.models";
4
+ /**
5
+ * Registers ANY Angular component as a TipTap node extension.
6
+ *
7
+ * This function is the single public entry point for adding custom components.
8
+ * It supports two distinct modes:
9
+ *
10
+ * 1. **TipTap-Aware Mode** (the component extends `AteAngularNodeView`):
11
+ * Grants direct access to the TipTap API (`editor`, `node`, `updateAttributes`, etc.) within the component.
12
+ *
13
+ * 2. **Standard Mode** (library or legacy components):
14
+ * Allows using any existing Angular component. Its `@Input()` properties are automatically
15
+ * synchronized with TipTap node attributes.
16
+ *
17
+ * @param injectorOrOptions - The Angular Injector OR the configuration options
18
+ * @param maybeOptions - Configuration options (if the first param was an injector)
19
+ * @returns A TipTap Node extension ready to be used
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * // Modern way (requires provideAteEditor())
24
+ * registerAngularComponent({
25
+ * component: MyComponent,
26
+ * name: 'myComponent'
27
+ * });
28
+ *
29
+ * // Classic way
30
+ * registerAngularComponent(injector, {
31
+ * component: MyComponent
32
+ * });
33
+ * ```
34
+ */
35
+ export declare function registerAngularComponent<T = unknown>(injectorOrOptions: Injector | RegisterAngularComponentOptions<T>, maybeOptions?: RegisterAngularComponentOptions<T>): Node;
@@ -0,0 +1,65 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ import * as i0 from "@angular/core";
3
+ export interface AteColorPickerSelection {
4
+ from: number;
5
+ to: number;
6
+ }
7
+ export type AteColorEditMode = "text" | "highlight";
8
+ export declare class AteColorPickerService {
9
+ private storedSelection;
10
+ /** Current edit mode: null when closed, 'text' or 'highlight' when open */
11
+ readonly editMode: import("@angular/core").WritableSignal<AteColorEditMode | null>;
12
+ /** Reference to the element that triggered the menu (for anchoring) */
13
+ readonly menuTrigger: import("@angular/core").WritableSignal<HTMLElement | null>;
14
+ /** Whether the user is currently interacting with the picker UI (e.g. typing) */
15
+ readonly isInteracting: import("@angular/core").WritableSignal<boolean>;
16
+ /**
17
+ * Open the color picker menu in the specified mode.
18
+ */
19
+ open(mode: AteColorEditMode, trigger?: HTMLElement): void;
20
+ /**
21
+ * Close the color picker menu.
22
+ */
23
+ close(): void;
24
+ /**
25
+ * Set interaction state (prevents premature closing when blurring editor)
26
+ */
27
+ setInteracting(value: boolean): void;
28
+ /**
29
+ * Toggle color picker from UI (extracts trigger from event).
30
+ */
31
+ toggle(editor: Editor, mode: AteColorEditMode, event?: Event): void;
32
+ /**
33
+ * Capture current editor selection.
34
+ */
35
+ captureSelection(editor: Editor): void;
36
+ /**
37
+ * Get last captured selection.
38
+ */
39
+ getStoredSelection(): AteColorPickerSelection | null;
40
+ /**
41
+ * Clear captured selection.
42
+ */
43
+ done(): void;
44
+ /**
45
+ * Apply text color to selection.
46
+ */
47
+ applyColor(editor: Editor, color: string, addToHistory?: boolean, focus?: boolean): void;
48
+ /**
49
+ * Remove text color from selection.
50
+ */
51
+ unsetColor(editor: Editor, focus?: boolean): void;
52
+ /**
53
+ * Apply highlight color to selection.
54
+ */
55
+ applyHighlight(editor: Editor, color: string, addToHistory?: boolean, focus?: boolean): void;
56
+ /**
57
+ * Remove highlight from selection.
58
+ */
59
+ unsetHighlight(editor: Editor, focus?: boolean): void;
60
+ normalizeColor(color: string | null | undefined): string;
61
+ getLuminance(color: string): number;
62
+ getContrastColor(color: string): "black" | "white";
63
+ static ɵfac: i0.ɵɵFactoryDeclaration<AteColorPickerService, never>;
64
+ static ɵprov: i0.ɵɵInjectableDeclaration<AteColorPickerService>;
65
+ }
@@ -0,0 +1,75 @@
1
+ import { Editor } from "@tiptap/core";
2
+ import { AteEditorStateSnapshot } from "../models/ate-editor-state.model";
3
+ import { AteImageUploadHandler, AteImageUploadOptions } from "../models/ate-image.model";
4
+ import * as i0 from "@angular/core";
5
+ export declare class AteEditorCommandsService {
6
+ private imageService;
7
+ private colorPickerSvc;
8
+ private linkSvc;
9
+ private readonly _editorState;
10
+ /** Exposed editor state as a readonly signal */
11
+ readonly editorState: import("@angular/core").Signal<AteEditorStateSnapshot>;
12
+ /** Signal to track when the toolbar is being hovered/interacted with */
13
+ private readonly _isToolbarInteracting;
14
+ readonly isToolbarInteracting: import("@angular/core").Signal<boolean>;
15
+ /** Set toolbar interaction state (called by editor component) */
16
+ setToolbarInteracting(value: boolean): void;
17
+ readonly isUploading: import("@angular/core").Signal<boolean>;
18
+ readonly uploadProgress: import("@angular/core").Signal<number>;
19
+ readonly uploadMessage: import("@angular/core").Signal<string>;
20
+ set uploadHandler(handler: AteImageUploadHandler | null);
21
+ /** Update state (called by TiptapStateExtension) */
22
+ updateState(state: AteEditorStateSnapshot): void;
23
+ /** Signal to toggle link edit mode from UI (Toolbar) - Immediate response */
24
+ readonly linkEditMode: import("@angular/core").Signal<boolean>;
25
+ /** Reference to the element that triggered the link menu (for anchoring) */
26
+ readonly linkMenuTrigger: import("@angular/core").Signal<HTMLElement | null>;
27
+ /** Signal to toggle color picker mode from UI (text or highlight) */
28
+ readonly colorEditMode: import("@angular/core").Signal<import("./ate-color-picker.service").AteColorEditMode | null>;
29
+ /** Reference to the element that triggered the color menu (for anchoring) */
30
+ readonly colorMenuTrigger: import("@angular/core").Signal<HTMLElement | null>;
31
+ /** Generic method to execute any command by name */
32
+ execute(editor: Editor, command: string, ...args: unknown[]): void;
33
+ toggleBold(editor: Editor): void;
34
+ toggleItalic(editor: Editor): void;
35
+ toggleStrike(editor: Editor): void;
36
+ toggleCode(editor: Editor): void;
37
+ toggleCodeBlock(editor: Editor): void;
38
+ toggleUnderline(editor: Editor): void;
39
+ toggleSuperscript(editor: Editor): void;
40
+ toggleSubscript(editor: Editor): void;
41
+ toggleHeading(editor: Editor, level: 1 | 2 | 3): void;
42
+ toggleHighlight(editor: Editor, color?: string): void;
43
+ toggleBulletList(editor: Editor): void;
44
+ toggleOrderedList(editor: Editor): void;
45
+ toggleBlockquote(editor: Editor): void;
46
+ setTextAlign(editor: Editor, alignment: "left" | "center" | "right" | "justify"): void;
47
+ insertHorizontalRule(editor: Editor): void;
48
+ undo(editor: Editor): void;
49
+ redo(editor: Editor): void;
50
+ insertTable(editor: Editor, rows?: number, cols?: number): void;
51
+ addColumnBefore(editor: Editor): void;
52
+ addColumnAfter(editor: Editor): void;
53
+ deleteColumn(editor: Editor): void;
54
+ addRowBefore(editor: Editor): void;
55
+ addRowAfter(editor: Editor): void;
56
+ deleteRow(editor: Editor): void;
57
+ deleteTable(editor: Editor): void;
58
+ mergeCells(editor: Editor): void;
59
+ splitCell(editor: Editor): void;
60
+ toggleHeaderColumn(editor: Editor): void;
61
+ toggleHeaderRow(editor: Editor): void;
62
+ clearContent(editor: Editor): void;
63
+ focus(editor: Editor): void;
64
+ blur(editor: Editor): void;
65
+ setContent(editor: Editor, content: string, emitUpdate?: boolean): void;
66
+ setEditable(editor: Editor, editable: boolean): void;
67
+ insertContent(editor: Editor, content: string): void;
68
+ insertImage(editor: Editor, options?: AteImageUploadOptions): Promise<void>;
69
+ uploadImage(editor: Editor, file: File, options?: AteImageUploadOptions): Promise<void>;
70
+ downloadImage(editor: Editor): void;
71
+ handleImageDrop(editor: Editor, event: DragEvent, options?: AteImageUploadOptions): boolean;
72
+ handleImagePaste(editor: Editor, event: ClipboardEvent, options?: AteImageUploadOptions): boolean;
73
+ static ɵfac: i0.ɵɵFactoryDeclaration<AteEditorCommandsService, never>;
74
+ static ɵprov: i0.ɵɵInjectableDeclaration<AteEditorCommandsService>;
75
+ }
@@ -0,0 +1,406 @@
1
+ import * as i0 from "@angular/core";
2
+ export type SupportedLocale = "en" | "fr" | (string & {});
3
+ export interface AteTranslations {
4
+ toolbar: {
5
+ bold: string;
6
+ italic: string;
7
+ underline: string;
8
+ strike: string;
9
+ code: string;
10
+ codeBlock: string;
11
+ superscript: string;
12
+ subscript: string;
13
+ highlight: string;
14
+ highlightPicker: string;
15
+ heading1: string;
16
+ heading2: string;
17
+ heading3: string;
18
+ bulletList: string;
19
+ orderedList: string;
20
+ blockquote: string;
21
+ alignLeft: string;
22
+ alignCenter: string;
23
+ alignRight: string;
24
+ alignJustify: string;
25
+ link: string;
26
+ image: string;
27
+ horizontalRule: string;
28
+ table: string;
29
+ undo: string;
30
+ redo: string;
31
+ clear: string;
32
+ textColor: string;
33
+ customColor: string;
34
+ presets: string;
35
+ };
36
+ bubbleMenu: {
37
+ bold: string;
38
+ italic: string;
39
+ underline: string;
40
+ strike: string;
41
+ code: string;
42
+ superscript: string;
43
+ subscript: string;
44
+ highlight: string;
45
+ highlightPicker: string;
46
+ textColor: string;
47
+ link: string;
48
+ addLink: string;
49
+ editLink: string;
50
+ removeLink: string;
51
+ linkUrl: string;
52
+ linkText: string;
53
+ openLink: string;
54
+ customColor: string;
55
+ presets: string;
56
+ };
57
+ slashCommands: {
58
+ heading1: {
59
+ title: string;
60
+ description: string;
61
+ keywords: string[];
62
+ };
63
+ heading2: {
64
+ title: string;
65
+ description: string;
66
+ keywords: string[];
67
+ };
68
+ heading3: {
69
+ title: string;
70
+ description: string;
71
+ keywords: string[];
72
+ };
73
+ bulletList: {
74
+ title: string;
75
+ description: string;
76
+ keywords: string[];
77
+ };
78
+ orderedList: {
79
+ title: string;
80
+ description: string;
81
+ keywords: string[];
82
+ };
83
+ blockquote: {
84
+ title: string;
85
+ description: string;
86
+ keywords: string[];
87
+ };
88
+ code: {
89
+ title: string;
90
+ description: string;
91
+ keywords: string[];
92
+ };
93
+ image: {
94
+ title: string;
95
+ description: string;
96
+ keywords: string[];
97
+ };
98
+ horizontalRule: {
99
+ title: string;
100
+ description: string;
101
+ keywords: string[];
102
+ };
103
+ table: {
104
+ title: string;
105
+ description: string;
106
+ keywords: string[];
107
+ };
108
+ };
109
+ table: {
110
+ addRowBefore: string;
111
+ addRowAfter: string;
112
+ deleteRow: string;
113
+ addColumnBefore: string;
114
+ addColumnAfter: string;
115
+ deleteColumn: string;
116
+ deleteTable: string;
117
+ toggleHeaderRow: string;
118
+ toggleHeaderColumn: string;
119
+ mergeCells: string;
120
+ splitCell: string;
121
+ };
122
+ imageUpload: {
123
+ selectImage: string;
124
+ loadError: string;
125
+ uploadingImage: string;
126
+ uploadProgress: string;
127
+ uploadError: string;
128
+ uploadSuccess: string;
129
+ imageTooLarge: string;
130
+ invalidFileType: string;
131
+ dragDropText: string;
132
+ changeImage: string;
133
+ downloadImage: string;
134
+ deleteImage: string;
135
+ resizeSmall: string;
136
+ resizeMedium: string;
137
+ resizeLarge: string;
138
+ resizeOriginal: string;
139
+ alignLeft: string;
140
+ alignCenter: string;
141
+ alignRight: string;
142
+ resizing: string;
143
+ compressing: string;
144
+ compressionError: string;
145
+ validating: string;
146
+ uploadingToServer: string;
147
+ replacingImage: string;
148
+ insertingImage: string;
149
+ noFileSelected: string;
150
+ selectionCancelled: string;
151
+ };
152
+ editor: {
153
+ placeholder: string;
154
+ character: string;
155
+ word: string;
156
+ linkPrompt: string;
157
+ linkUrlPrompt: string;
158
+ confirmDelete: string;
159
+ toggleEdit: string;
160
+ viewMode: string;
161
+ blockAdd: string;
162
+ blockDrag: string;
163
+ };
164
+ common: {
165
+ cancel: string;
166
+ confirm: string;
167
+ apply: string;
168
+ delete: string;
169
+ save: string;
170
+ close: string;
171
+ loading: string;
172
+ error: string;
173
+ success: string;
174
+ };
175
+ }
176
+ export declare class AteI18nService {
177
+ private _currentLocale;
178
+ private _translations;
179
+ readonly currentLocale: import("@angular/core").Signal<SupportedLocale>;
180
+ /** All loaded translations (useful for dynamic key access) */
181
+ readonly allTranslations: import("@angular/core").Signal<Record<SupportedLocale, AteTranslations>>;
182
+ readonly translations: import("@angular/core").Signal<AteTranslations>;
183
+ readonly t: import("@angular/core").Signal<AteTranslations>;
184
+ readonly toolbar: import("@angular/core").Signal<{
185
+ bold: string;
186
+ italic: string;
187
+ underline: string;
188
+ strike: string;
189
+ code: string;
190
+ codeBlock: string;
191
+ superscript: string;
192
+ subscript: string;
193
+ highlight: string;
194
+ highlightPicker: string;
195
+ heading1: string;
196
+ heading2: string;
197
+ heading3: string;
198
+ bulletList: string;
199
+ orderedList: string;
200
+ blockquote: string;
201
+ alignLeft: string;
202
+ alignCenter: string;
203
+ alignRight: string;
204
+ alignJustify: string;
205
+ link: string;
206
+ image: string;
207
+ horizontalRule: string;
208
+ table: string;
209
+ undo: string;
210
+ redo: string;
211
+ clear: string;
212
+ textColor: string;
213
+ customColor: string;
214
+ presets: string;
215
+ }>;
216
+ readonly bubbleMenu: import("@angular/core").Signal<{
217
+ bold: string;
218
+ italic: string;
219
+ underline: string;
220
+ strike: string;
221
+ code: string;
222
+ superscript: string;
223
+ subscript: string;
224
+ highlight: string;
225
+ highlightPicker: string;
226
+ textColor: string;
227
+ link: string;
228
+ addLink: string;
229
+ editLink: string;
230
+ removeLink: string;
231
+ linkUrl: string;
232
+ linkText: string;
233
+ openLink: string;
234
+ customColor: string;
235
+ presets: string;
236
+ }>;
237
+ readonly slashCommands: import("@angular/core").Signal<{
238
+ heading1: {
239
+ title: string;
240
+ description: string;
241
+ keywords: string[];
242
+ };
243
+ heading2: {
244
+ title: string;
245
+ description: string;
246
+ keywords: string[];
247
+ };
248
+ heading3: {
249
+ title: string;
250
+ description: string;
251
+ keywords: string[];
252
+ };
253
+ bulletList: {
254
+ title: string;
255
+ description: string;
256
+ keywords: string[];
257
+ };
258
+ orderedList: {
259
+ title: string;
260
+ description: string;
261
+ keywords: string[];
262
+ };
263
+ blockquote: {
264
+ title: string;
265
+ description: string;
266
+ keywords: string[];
267
+ };
268
+ code: {
269
+ title: string;
270
+ description: string;
271
+ keywords: string[];
272
+ };
273
+ image: {
274
+ title: string;
275
+ description: string;
276
+ keywords: string[];
277
+ };
278
+ horizontalRule: {
279
+ title: string;
280
+ description: string;
281
+ keywords: string[];
282
+ };
283
+ table: {
284
+ title: string;
285
+ description: string;
286
+ keywords: string[];
287
+ };
288
+ }>;
289
+ readonly table: import("@angular/core").Signal<{
290
+ addRowBefore: string;
291
+ addRowAfter: string;
292
+ deleteRow: string;
293
+ addColumnBefore: string;
294
+ addColumnAfter: string;
295
+ deleteColumn: string;
296
+ deleteTable: string;
297
+ toggleHeaderRow: string;
298
+ toggleHeaderColumn: string;
299
+ mergeCells: string;
300
+ splitCell: string;
301
+ }>;
302
+ readonly imageUpload: import("@angular/core").Signal<{
303
+ selectImage: string;
304
+ loadError: string;
305
+ uploadingImage: string;
306
+ uploadProgress: string;
307
+ uploadError: string;
308
+ uploadSuccess: string;
309
+ imageTooLarge: string;
310
+ invalidFileType: string;
311
+ dragDropText: string;
312
+ changeImage: string;
313
+ downloadImage: string;
314
+ deleteImage: string;
315
+ resizeSmall: string;
316
+ resizeMedium: string;
317
+ resizeLarge: string;
318
+ resizeOriginal: string;
319
+ alignLeft: string;
320
+ alignCenter: string;
321
+ alignRight: string;
322
+ resizing: string;
323
+ compressing: string;
324
+ compressionError: string;
325
+ validating: string;
326
+ uploadingToServer: string;
327
+ replacingImage: string;
328
+ insertingImage: string;
329
+ noFileSelected: string;
330
+ selectionCancelled: string;
331
+ }>;
332
+ readonly editor: import("@angular/core").Signal<{
333
+ placeholder: string;
334
+ character: string;
335
+ word: string;
336
+ linkPrompt: string;
337
+ linkUrlPrompt: string;
338
+ confirmDelete: string;
339
+ toggleEdit: string;
340
+ viewMode: string;
341
+ blockAdd: string;
342
+ blockDrag: string;
343
+ }>;
344
+ readonly common: import("@angular/core").Signal<{
345
+ cancel: string;
346
+ confirm: string;
347
+ apply: string;
348
+ delete: string;
349
+ save: string;
350
+ close: string;
351
+ loading: string;
352
+ error: string;
353
+ success: string;
354
+ }>;
355
+ constructor();
356
+ setLocale(locale: SupportedLocale): void;
357
+ autoDetectLocale(): void;
358
+ getSupportedLocales(): SupportedLocale[];
359
+ addTranslations(locale: string, translations: AteTranslations | Partial<AteTranslations>): void;
360
+ private detectBrowserLanguage;
361
+ getToolbarTitle(key: keyof AteTranslations["toolbar"]): string;
362
+ getBubbleMenuTitle(key: keyof AteTranslations["bubbleMenu"]): string;
363
+ getSlashCommand(key: keyof AteTranslations["slashCommands"]): {
364
+ title: string;
365
+ description: string;
366
+ keywords: string[];
367
+ } | {
368
+ title: string;
369
+ description: string;
370
+ keywords: string[];
371
+ } | {
372
+ title: string;
373
+ description: string;
374
+ keywords: string[];
375
+ } | {
376
+ title: string;
377
+ description: string;
378
+ keywords: string[];
379
+ } | {
380
+ title: string;
381
+ description: string;
382
+ keywords: string[];
383
+ } | {
384
+ title: string;
385
+ description: string;
386
+ keywords: string[];
387
+ } | {
388
+ title: string;
389
+ description: string;
390
+ keywords: string[];
391
+ } | {
392
+ title: string;
393
+ description: string;
394
+ keywords: string[];
395
+ } | {
396
+ title: string;
397
+ description: string;
398
+ keywords: string[];
399
+ } | {
400
+ title: string;
401
+ description: string;
402
+ keywords: string[];
403
+ };
404
+ static ɵfac: i0.ɵɵFactoryDeclaration<AteI18nService, never>;
405
+ static ɵprov: i0.ɵɵInjectableDeclaration<AteI18nService>;
406
+ }
@@ -0,0 +1,82 @@
1
+ import { Editor } from "@tiptap/core";
2
+ import { AteResizeOptions, AteImageUploadOptions, AteImageUploadHandler, AteImageUploadResult, AteImageData } from "../models/ate-image.model";
3
+ import * as i0 from "@angular/core";
4
+ export declare class AteImageService {
5
+ /** Signals for image state */
6
+ selectedImage: import("@angular/core").WritableSignal<AteImageData | null>;
7
+ isImageSelected: import("@angular/core").Signal<boolean>;
8
+ /** Resizing state */
9
+ isResizing: import("@angular/core").WritableSignal<boolean>;
10
+ private i18n;
11
+ private readonly t;
12
+ /** Upload state signals */
13
+ isUploading: import("@angular/core").WritableSignal<boolean>;
14
+ uploadProgress: import("@angular/core").WritableSignal<number>;
15
+ uploadMessage: import("@angular/core").WritableSignal<string>;
16
+ /**
17
+ * Custom upload handler.
18
+ * If set, this handler replaces the default base64 conversion.
19
+ */
20
+ uploadHandler: AteImageUploadHandler | null;
21
+ private currentEditor;
22
+ /** Select and track an image from the editor */
23
+ selectImage(editor: Editor): void;
24
+ clearSelection(): void;
25
+ /** Insert a new image and ensure it's selected */
26
+ insertImage(editor: Editor, imageData: AteImageData): void;
27
+ /** Update attributes of the currently active image */
28
+ updateImageAttributes(editor: Editor, attributes: Partial<AteImageData>): void;
29
+ /** Resize image with optional aspect ratio maintenance */
30
+ resizeImage(editor: Editor, options: AteResizeOptions): void;
31
+ /** Predetermined resize helpers used by UI */
32
+ resizeImageToSmall(editor: Editor): void;
33
+ resizeImageToMedium(editor: Editor): void;
34
+ resizeImageToLarge(editor: Editor): void;
35
+ resizeImageToOriginal(editor: Editor): void;
36
+ /** Get current image dimensions */
37
+ getImageDimensions(editor: Editor): {
38
+ width: number;
39
+ height: number;
40
+ } | null;
41
+ /** Remove the selected image */
42
+ deleteImage(editor: Editor): void;
43
+ /** Download the current image */
44
+ downloadImage(editor: Editor): void;
45
+ private updateSelectedImage;
46
+ /** Validate file type and size */
47
+ validateImage(file: File, options?: {
48
+ maxSize?: number;
49
+ allowedTypes?: string[];
50
+ }): {
51
+ valid: boolean;
52
+ error?: string;
53
+ };
54
+ /** Compress and process image on client side */
55
+ compressImage(file: File, quality?: number, maxWidth?: number, maxHeight?: number): Promise<AteImageUploadResult>;
56
+ /** Core upload logic with progress tracking */
57
+ private uploadImageWithProgress;
58
+ private resetUploadState;
59
+ /** Main entry point for file upload and insertion */
60
+ uploadAndInsertImage(editor: Editor, file: File, options?: AteImageUploadOptions): Promise<void>;
61
+ /** Trigger an editor transaction to force decoration update */
62
+ private forceEditorUpdate;
63
+ /** Generic helper to open file picker and process selection */
64
+ private selectFileAndProcess;
65
+ /** Select file and upload as new image */
66
+ selectAndUploadImage(editor: Editor, options?: AteImageUploadOptions): Promise<void>;
67
+ /** Select file and replace currently selected image */
68
+ selectAndReplaceImage(editor: Editor, options?: AteImageUploadOptions): Promise<void>;
69
+ /** Internal helper used by replacement logic */
70
+ uploadAndReplaceImage(editor: Editor, file: File, options?: AteImageUploadOptions): Promise<void>;
71
+ /**
72
+ * Handle image drop event.
73
+ * Calculates the position from coordinates and sets the selection accordingly.
74
+ */
75
+ handleDrop(editor: Editor, event: DragEvent, options?: AteImageUploadOptions): boolean;
76
+ /**
77
+ * Handle image paste event.
78
+ */
79
+ handlePaste(editor: Editor, event: ClipboardEvent, options?: AteImageUploadOptions): boolean;
80
+ static ɵfac: i0.ɵɵFactoryDeclaration<AteImageService, never>;
81
+ static ɵprov: i0.ɵɵInjectableDeclaration<AteImageService>;
82
+ }