@flogeez/angular-tiptap-editor 2.4.0 → 2.4.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/esm2022/flogeez-angular-tiptap-editor.mjs +5 -0
  3. package/esm2022/lib/ate-editor.provider.mjs +38 -0
  4. package/esm2022/lib/components/bubble-menus/base/ate-base-bubble-menu.mjs +207 -0
  5. package/esm2022/lib/components/bubble-menus/base/ate-base-sub-bubble-menu.mjs +133 -0
  6. package/esm2022/lib/components/bubble-menus/color/ate-color-bubble-menu.component.mjs +365 -0
  7. package/esm2022/lib/components/bubble-menus/image/ate-image-bubble-menu.component.mjs +226 -0
  8. package/esm2022/lib/components/bubble-menus/link/ate-link-bubble-menu.component.mjs +247 -0
  9. package/esm2022/lib/components/bubble-menus/table/ate-cell-bubble-menu.component.mjs +121 -0
  10. package/esm2022/lib/components/bubble-menus/table/ate-table-bubble-menu.component.mjs +266 -0
  11. package/esm2022/lib/components/bubble-menus/text/ate-bubble-menu.component.mjs +294 -0
  12. package/esm2022/lib/components/color-picker/ate-color-picker.component.mjs +122 -0
  13. package/esm2022/lib/components/edit-toggle/ate-edit-toggle.component.mjs +42 -0
  14. package/esm2022/lib/components/editor/angular-tiptap-editor.component.mjs +953 -0
  15. package/esm2022/lib/components/slash-commands/ate-slash-commands.component.mjs +329 -0
  16. package/esm2022/lib/components/toolbar/ate-toolbar.component.mjs +531 -0
  17. package/esm2022/lib/components/ui/ate-button.component.mjs +90 -0
  18. package/esm2022/lib/components/ui/ate-separator.component.mjs +31 -0
  19. package/esm2022/lib/config/ate-editor.config.mjs +76 -0
  20. package/esm2022/lib/config/ate-global-config.token.mjs +6 -0
  21. package/esm2022/lib/config/ate-slash-commands.config.mjs +130 -0
  22. package/esm2022/lib/directives/ate-noop-value-accessor.directive.mjs +40 -0
  23. package/esm2022/lib/extensions/ate-link-click-behavior.extension.mjs +32 -0
  24. package/esm2022/lib/extensions/ate-resizable-image.extension.mjs +270 -0
  25. package/esm2022/lib/extensions/ate-table.extension.mjs +29 -0
  26. package/esm2022/lib/extensions/ate-tiptap-state.extension.mjs +85 -0
  27. package/esm2022/lib/extensions/ate-upload-progress.extension.mjs +195 -0
  28. package/esm2022/lib/extensions/calculators/ate-discovery.calculator.mjs +62 -0
  29. package/esm2022/lib/extensions/calculators/ate-image.calculator.mjs +8 -0
  30. package/esm2022/lib/extensions/calculators/ate-marks.calculator.mjs +75 -0
  31. package/esm2022/lib/extensions/calculators/ate-selection.calculator.mjs +35 -0
  32. package/esm2022/lib/extensions/calculators/ate-structure.calculator.mjs +34 -0
  33. package/esm2022/lib/extensions/calculators/ate-table.calculator.mjs +38 -0
  34. package/esm2022/lib/models/ate-bubble-menu.model.mjs +49 -0
  35. package/esm2022/lib/models/ate-editor-config.model.mjs +2 -0
  36. package/esm2022/lib/models/ate-editor-state.model.mjs +90 -0
  37. package/esm2022/lib/models/ate-image.model.mjs +2 -0
  38. package/esm2022/lib/models/ate-toolbar.model.mjs +35 -0
  39. package/esm2022/lib/node-view/ate-angular-node-view.mjs +97 -0
  40. package/esm2022/lib/node-view/ate-injector.registry.mjs +16 -0
  41. package/esm2022/lib/node-view/ate-node-view.factory.mjs +125 -0
  42. package/esm2022/lib/node-view/ate-node-view.models.mjs +2 -0
  43. package/esm2022/lib/node-view/ate-node-view.renderer.mjs +154 -0
  44. package/esm2022/lib/node-view/ate-register-angular-component.mjs +49 -0
  45. package/esm2022/lib/services/ate-color-picker.service.mjs +193 -0
  46. package/esm2022/lib/services/ate-editor-commands.service.mjs +465 -0
  47. package/esm2022/lib/services/ate-i18n.service.mjs +410 -0
  48. package/esm2022/lib/services/ate-image.service.mjs +368 -0
  49. package/esm2022/lib/services/ate-link.service.mjs +97 -0
  50. package/esm2022/lib/utils/ate-color.utils.mjs +60 -0
  51. package/esm2022/public-api.mjs +93 -0
  52. package/fesm2022/flogeez-angular-tiptap-editor.mjs +313 -346
  53. package/fesm2022/flogeez-angular-tiptap-editor.mjs.map +1 -1
  54. package/index.d.ts +3 -1673
  55. package/lib/ate-editor.provider.d.ts +21 -0
  56. package/lib/components/bubble-menus/base/ate-base-bubble-menu.d.ts +71 -0
  57. package/lib/components/bubble-menus/base/ate-base-sub-bubble-menu.d.ts +60 -0
  58. package/lib/components/bubble-menus/color/ate-color-bubble-menu.component.d.ts +77 -0
  59. package/lib/components/bubble-menus/image/ate-image-bubble-menu.component.d.ts +52 -0
  60. package/lib/components/bubble-menus/link/ate-link-bubble-menu.component.d.ts +55 -0
  61. package/lib/components/bubble-menus/table/ate-cell-bubble-menu.component.d.ts +12 -0
  62. package/lib/components/bubble-menus/table/ate-table-bubble-menu.component.d.ts +24 -0
  63. package/lib/components/bubble-menus/text/ate-bubble-menu.component.d.ts +53 -0
  64. package/lib/components/color-picker/ate-color-picker.component.d.ts +54 -0
  65. package/lib/components/edit-toggle/ate-edit-toggle.component.d.ts +13 -0
  66. package/lib/components/editor/angular-tiptap-editor.component.d.ts +235 -0
  67. package/lib/components/slash-commands/ate-slash-commands.component.d.ts +43 -0
  68. package/lib/components/toolbar/ate-toolbar.component.d.ts +47 -0
  69. package/lib/components/ui/ate-button.component.d.ts +25 -0
  70. package/lib/components/ui/ate-separator.component.d.ts +7 -0
  71. package/lib/config/ate-editor.config.d.ts +7 -0
  72. package/lib/config/ate-global-config.token.d.ts +6 -0
  73. package/lib/config/ate-slash-commands.config.d.ts +41 -0
  74. package/lib/directives/ate-noop-value-accessor.directive.d.ts +13 -0
  75. package/lib/extensions/ate-link-click-behavior.extension.d.ts +2 -0
  76. package/lib/extensions/ate-resizable-image.extension.d.ts +27 -0
  77. package/lib/extensions/ate-table.extension.d.ts +2 -0
  78. package/lib/extensions/ate-tiptap-state.extension.d.ts +7 -0
  79. package/lib/extensions/ate-upload-progress.extension.d.ts +7 -0
  80. package/lib/extensions/calculators/ate-discovery.calculator.d.ts +7 -0
  81. package/lib/extensions/calculators/ate-image.calculator.d.ts +2 -0
  82. package/lib/extensions/calculators/ate-marks.calculator.d.ts +2 -0
  83. package/lib/extensions/calculators/ate-selection.calculator.d.ts +2 -0
  84. package/lib/extensions/calculators/ate-structure.calculator.d.ts +2 -0
  85. package/lib/extensions/calculators/ate-table.calculator.d.ts +2 -0
  86. package/lib/models/ate-bubble-menu.model.d.ts +33 -0
  87. package/lib/models/ate-editor-config.model.d.ts +100 -0
  88. package/lib/models/ate-editor-state.model.d.ts +109 -0
  89. package/lib/models/ate-image.model.d.ts +104 -0
  90. package/lib/models/ate-toolbar.model.d.ts +18 -0
  91. package/lib/node-view/ate-angular-node-view.d.ts +115 -0
  92. package/lib/node-view/ate-injector.registry.d.ts +3 -0
  93. package/lib/node-view/ate-node-view.factory.d.ts +10 -0
  94. package/lib/node-view/ate-node-view.models.d.ts +138 -0
  95. package/lib/node-view/ate-node-view.renderer.d.ts +23 -0
  96. package/lib/node-view/ate-register-angular-component.d.ts +35 -0
  97. package/lib/services/ate-color-picker.service.d.ts +65 -0
  98. package/lib/services/ate-editor-commands.service.d.ts +72 -0
  99. package/lib/services/ate-i18n.service.d.ts +394 -0
  100. package/lib/services/ate-image.service.d.ts +71 -0
  101. package/lib/services/ate-link.service.d.ts +42 -0
  102. package/lib/utils/ate-color.utils.d.ts +12 -0
  103. package/package.json +3 -1
  104. package/public-api.d.ts +112 -0
@@ -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,72 @@
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
+ static ɵfac: i0.ɵɵFactoryDeclaration<AteEditorCommandsService, never>;
71
+ static ɵprov: i0.ɵɵInjectableDeclaration<AteEditorCommandsService>;
72
+ }
@@ -0,0 +1,394 @@
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
+ deleteImage: string;
134
+ resizeSmall: string;
135
+ resizeMedium: string;
136
+ resizeLarge: string;
137
+ resizeOriginal: string;
138
+ resizing: string;
139
+ compressing: string;
140
+ compressionError: string;
141
+ validating: string;
142
+ uploadingToServer: string;
143
+ replacingImage: string;
144
+ insertingImage: string;
145
+ noFileSelected: string;
146
+ selectionCancelled: string;
147
+ };
148
+ editor: {
149
+ placeholder: string;
150
+ character: string;
151
+ word: string;
152
+ linkPrompt: string;
153
+ linkUrlPrompt: string;
154
+ confirmDelete: string;
155
+ toggleEdit: string;
156
+ viewMode: string;
157
+ };
158
+ common: {
159
+ cancel: string;
160
+ confirm: string;
161
+ apply: string;
162
+ delete: string;
163
+ save: string;
164
+ close: string;
165
+ loading: string;
166
+ error: string;
167
+ success: string;
168
+ };
169
+ }
170
+ export declare class AteI18nService {
171
+ private _currentLocale;
172
+ private _translations;
173
+ readonly currentLocale: import("@angular/core").Signal<SupportedLocale>;
174
+ /** All loaded translations (useful for dynamic key access) */
175
+ readonly allTranslations: import("@angular/core").Signal<Record<SupportedLocale, AteTranslations>>;
176
+ readonly translations: import("@angular/core").Signal<AteTranslations>;
177
+ readonly t: import("@angular/core").Signal<AteTranslations>;
178
+ readonly toolbar: import("@angular/core").Signal<{
179
+ bold: string;
180
+ italic: string;
181
+ underline: string;
182
+ strike: string;
183
+ code: string;
184
+ codeBlock: string;
185
+ superscript: string;
186
+ subscript: string;
187
+ highlight: string;
188
+ highlightPicker: string;
189
+ heading1: string;
190
+ heading2: string;
191
+ heading3: string;
192
+ bulletList: string;
193
+ orderedList: string;
194
+ blockquote: string;
195
+ alignLeft: string;
196
+ alignCenter: string;
197
+ alignRight: string;
198
+ alignJustify: string;
199
+ link: string;
200
+ image: string;
201
+ horizontalRule: string;
202
+ table: string;
203
+ undo: string;
204
+ redo: string;
205
+ clear: string;
206
+ textColor: string;
207
+ customColor: string;
208
+ presets: string;
209
+ }>;
210
+ readonly bubbleMenu: import("@angular/core").Signal<{
211
+ bold: string;
212
+ italic: string;
213
+ underline: string;
214
+ strike: string;
215
+ code: string;
216
+ superscript: string;
217
+ subscript: string;
218
+ highlight: string;
219
+ highlightPicker: string;
220
+ textColor: string;
221
+ link: string;
222
+ addLink: string;
223
+ editLink: string;
224
+ removeLink: string;
225
+ linkUrl: string;
226
+ linkText: string;
227
+ openLink: string;
228
+ customColor: string;
229
+ presets: string;
230
+ }>;
231
+ readonly slashCommands: import("@angular/core").Signal<{
232
+ heading1: {
233
+ title: string;
234
+ description: string;
235
+ keywords: string[];
236
+ };
237
+ heading2: {
238
+ title: string;
239
+ description: string;
240
+ keywords: string[];
241
+ };
242
+ heading3: {
243
+ title: string;
244
+ description: string;
245
+ keywords: string[];
246
+ };
247
+ bulletList: {
248
+ title: string;
249
+ description: string;
250
+ keywords: string[];
251
+ };
252
+ orderedList: {
253
+ title: string;
254
+ description: string;
255
+ keywords: string[];
256
+ };
257
+ blockquote: {
258
+ title: string;
259
+ description: string;
260
+ keywords: string[];
261
+ };
262
+ code: {
263
+ title: string;
264
+ description: string;
265
+ keywords: string[];
266
+ };
267
+ image: {
268
+ title: string;
269
+ description: string;
270
+ keywords: string[];
271
+ };
272
+ horizontalRule: {
273
+ title: string;
274
+ description: string;
275
+ keywords: string[];
276
+ };
277
+ table: {
278
+ title: string;
279
+ description: string;
280
+ keywords: string[];
281
+ };
282
+ }>;
283
+ readonly table: import("@angular/core").Signal<{
284
+ addRowBefore: string;
285
+ addRowAfter: string;
286
+ deleteRow: string;
287
+ addColumnBefore: string;
288
+ addColumnAfter: string;
289
+ deleteColumn: string;
290
+ deleteTable: string;
291
+ toggleHeaderRow: string;
292
+ toggleHeaderColumn: string;
293
+ mergeCells: string;
294
+ splitCell: string;
295
+ }>;
296
+ readonly imageUpload: import("@angular/core").Signal<{
297
+ selectImage: string;
298
+ loadError: string;
299
+ uploadingImage: string;
300
+ uploadProgress: string;
301
+ uploadError: string;
302
+ uploadSuccess: string;
303
+ imageTooLarge: string;
304
+ invalidFileType: string;
305
+ dragDropText: string;
306
+ changeImage: string;
307
+ deleteImage: string;
308
+ resizeSmall: string;
309
+ resizeMedium: string;
310
+ resizeLarge: string;
311
+ resizeOriginal: string;
312
+ resizing: string;
313
+ compressing: string;
314
+ compressionError: string;
315
+ validating: string;
316
+ uploadingToServer: string;
317
+ replacingImage: string;
318
+ insertingImage: string;
319
+ noFileSelected: string;
320
+ selectionCancelled: string;
321
+ }>;
322
+ readonly editor: import("@angular/core").Signal<{
323
+ placeholder: string;
324
+ character: string;
325
+ word: string;
326
+ linkPrompt: string;
327
+ linkUrlPrompt: string;
328
+ confirmDelete: string;
329
+ toggleEdit: string;
330
+ viewMode: string;
331
+ }>;
332
+ readonly common: import("@angular/core").Signal<{
333
+ cancel: string;
334
+ confirm: string;
335
+ apply: string;
336
+ delete: string;
337
+ save: string;
338
+ close: string;
339
+ loading: string;
340
+ error: string;
341
+ success: string;
342
+ }>;
343
+ constructor();
344
+ setLocale(locale: SupportedLocale): void;
345
+ autoDetectLocale(): void;
346
+ getSupportedLocales(): SupportedLocale[];
347
+ addTranslations(locale: string, translations: AteTranslations | Partial<AteTranslations>): void;
348
+ private detectBrowserLanguage;
349
+ getToolbarTitle(key: keyof AteTranslations["toolbar"]): string;
350
+ getBubbleMenuTitle(key: keyof AteTranslations["bubbleMenu"]): string;
351
+ getSlashCommand(key: keyof AteTranslations["slashCommands"]): {
352
+ title: string;
353
+ description: string;
354
+ keywords: string[];
355
+ } | {
356
+ title: string;
357
+ description: string;
358
+ keywords: string[];
359
+ } | {
360
+ title: string;
361
+ description: string;
362
+ keywords: string[];
363
+ } | {
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
+ static ɵfac: i0.ɵɵFactoryDeclaration<AteI18nService, never>;
393
+ static ɵprov: i0.ɵɵInjectableDeclaration<AteI18nService>;
394
+ }
@@ -0,0 +1,71 @@
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
+ private updateSelectedImage;
44
+ /** Validate file type and size */
45
+ validateImage(file: File, options?: {
46
+ maxSize?: number;
47
+ allowedTypes?: string[];
48
+ }): {
49
+ valid: boolean;
50
+ error?: string;
51
+ };
52
+ /** Compress and process image on client side */
53
+ compressImage(file: File, quality?: number, maxWidth?: number, maxHeight?: number): Promise<AteImageUploadResult>;
54
+ /** Core upload logic with progress tracking */
55
+ private uploadImageWithProgress;
56
+ private resetUploadState;
57
+ /** Main entry point for file upload and insertion */
58
+ uploadAndInsertImage(editor: Editor, file: File, options?: AteImageUploadOptions): Promise<void>;
59
+ /** Trigger an editor transaction to force decoration update */
60
+ private forceEditorUpdate;
61
+ /** Generic helper to open file picker and process selection */
62
+ private selectFileAndProcess;
63
+ /** Select file and upload as new image */
64
+ selectAndUploadImage(editor: Editor, options?: AteImageUploadOptions): Promise<void>;
65
+ /** Select file and replace currently selected image */
66
+ selectAndReplaceImage(editor: Editor, options?: AteImageUploadOptions): Promise<void>;
67
+ /** Internal helper used by replacement logic */
68
+ uploadAndReplaceImage(editor: Editor, file: File, options?: AteImageUploadOptions): Promise<void>;
69
+ static ɵfac: i0.ɵɵFactoryDeclaration<AteImageService, never>;
70
+ static ɵprov: i0.ɵɵInjectableDeclaration<AteImageService>;
71
+ }
@@ -0,0 +1,42 @@
1
+ import type { Editor } from "@tiptap/core";
2
+ import * as i0 from "@angular/core";
3
+ export declare class AteLinkService {
4
+ /** Whether link edit mode is active */
5
+ readonly editMode: import("@angular/core").WritableSignal<boolean>;
6
+ /** Reference to the element that triggered the menu (for anchoring) */
7
+ readonly menuTrigger: import("@angular/core").WritableSignal<HTMLElement | null>;
8
+ /** Whether the user is currently interacting with the link UI (input focus) */
9
+ readonly isInteracting: import("@angular/core").WritableSignal<boolean>;
10
+ /**
11
+ * Open the link edit menu.
12
+ */
13
+ open(trigger?: HTMLElement): void;
14
+ /**
15
+ * Close the link edit menu.
16
+ */
17
+ close(): void;
18
+ /**
19
+ * Final cleanup (called after UI is hidden)
20
+ */
21
+ done(): void;
22
+ /**
23
+ * Set interaction state
24
+ */
25
+ setInteracting(value: boolean): void;
26
+ /**
27
+ * Toggle link mode from UI.
28
+ * If a URL string is provided, applies the link and closes.
29
+ * If an Event is provided, extracts the trigger for anchoring.
30
+ */
31
+ toggle(editor: Editor, urlOrEvent?: string | Event): void;
32
+ /**
33
+ * Apply a link to the current selection.
34
+ */
35
+ setLink(editor: Editor, url: string): void;
36
+ /**
37
+ * Remove link from the current selection.
38
+ */
39
+ unsetLink(editor: Editor): void;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<AteLinkService, never>;
41
+ static ɵprov: i0.ɵɵInjectableDeclaration<AteLinkService>;
42
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Normalizes color values (rgb/rgba to hex).
3
+ */
4
+ export declare function normalizeColor(color: string | null | undefined): string | null;
5
+ /**
6
+ * Calculate luminance (0-255).
7
+ */
8
+ export declare function getLuminance(color: string | null | undefined): number;
9
+ /**
10
+ * Returns contrast color for readability.
11
+ */
12
+ export declare function getContrastColor(color: string): "black" | "white";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flogeez/angular-tiptap-editor",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
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",
@@ -61,6 +61,8 @@
61
61
  },
62
62
  ".": {
63
63
  "types": "./index.d.ts",
64
+ "esm2022": "./esm2022/flogeez-angular-tiptap-editor.mjs",
65
+ "esm": "./esm2022/flogeez-angular-tiptap-editor.mjs",
64
66
  "default": "./fesm2022/flogeez-angular-tiptap-editor.mjs"
65
67
  }
66
68
  }