@flogeez/angular-tiptap-editor 0.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/LICENSE +21 -0
- package/README.md +281 -0
- package/fesm2022/flogeez-angular-tiptap-editor.mjs +4240 -0
- package/fesm2022/flogeez-angular-tiptap-editor.mjs.map +1 -0
- package/index.d.ts +564 -0
- package/package.json +58 -0
- package/src/lib/styles/bubble-menu.global.css +32 -0
- package/src/lib/styles/index.css +53 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import * as _angular_core from '@angular/core';
|
|
3
|
+
import { OnInit, AfterViewInit, OnDestroy, ElementRef } from '@angular/core';
|
|
4
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
5
|
+
|
|
6
|
+
interface SlashCommandItem {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
keywords: string[];
|
|
11
|
+
command: (editor: Editor) => void;
|
|
12
|
+
}
|
|
13
|
+
interface SlashCommandsConfig {
|
|
14
|
+
commands?: SlashCommandItem[];
|
|
15
|
+
}
|
|
16
|
+
declare const DEFAULT_SLASH_COMMANDS: SlashCommandItem[];
|
|
17
|
+
|
|
18
|
+
interface ImageData {
|
|
19
|
+
src: string;
|
|
20
|
+
alt?: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
width?: number;
|
|
23
|
+
height?: number;
|
|
24
|
+
}
|
|
25
|
+
interface ImageUploadResult {
|
|
26
|
+
src: string;
|
|
27
|
+
name: string;
|
|
28
|
+
size: number;
|
|
29
|
+
type: string;
|
|
30
|
+
width?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
originalSize?: number;
|
|
33
|
+
}
|
|
34
|
+
interface ResizeOptions {
|
|
35
|
+
width?: number;
|
|
36
|
+
height?: number;
|
|
37
|
+
maintainAspectRatio?: boolean;
|
|
38
|
+
}
|
|
39
|
+
declare class ImageService {
|
|
40
|
+
selectedImage: _angular_core.WritableSignal<ImageData | null>;
|
|
41
|
+
isImageSelected: _angular_core.Signal<boolean>;
|
|
42
|
+
isResizing: _angular_core.WritableSignal<boolean>;
|
|
43
|
+
isUploading: _angular_core.WritableSignal<boolean>;
|
|
44
|
+
uploadProgress: _angular_core.WritableSignal<number>;
|
|
45
|
+
uploadMessage: _angular_core.WritableSignal<string>;
|
|
46
|
+
private currentEditor;
|
|
47
|
+
selectImage(editor: Editor): void;
|
|
48
|
+
clearSelection(): void;
|
|
49
|
+
insertImage(editor: Editor, imageData: ImageData): void;
|
|
50
|
+
updateImageAttributes(editor: Editor, attributes: Partial<ImageData>): void;
|
|
51
|
+
resizeImage(editor: Editor, options: ResizeOptions): void;
|
|
52
|
+
resizeImageByPercentage(editor: Editor, percentage: number): void;
|
|
53
|
+
resizeImageToSmall(editor: Editor): void;
|
|
54
|
+
resizeImageToMedium(editor: Editor): void;
|
|
55
|
+
resizeImageToLarge(editor: Editor): void;
|
|
56
|
+
resizeImageToOriginal(editor: Editor): void;
|
|
57
|
+
resizeImageFreely(editor: Editor, width: number, height: number): void;
|
|
58
|
+
getImageDimensions(editor: Editor): {
|
|
59
|
+
width: number;
|
|
60
|
+
height: number;
|
|
61
|
+
} | null;
|
|
62
|
+
getNaturalImageDimensions(src: string): Promise<{
|
|
63
|
+
width: number;
|
|
64
|
+
height: number;
|
|
65
|
+
}>;
|
|
66
|
+
deleteImage(editor: Editor): void;
|
|
67
|
+
private updateSelectedImage;
|
|
68
|
+
validateImage(file: File, maxSize?: number): {
|
|
69
|
+
valid: boolean;
|
|
70
|
+
error?: string;
|
|
71
|
+
};
|
|
72
|
+
compressImage(file: File, quality?: number, maxWidth?: number, maxHeight?: number): Promise<ImageUploadResult>;
|
|
73
|
+
private uploadImageWithProgress;
|
|
74
|
+
uploadAndInsertImage(editor: Editor, file: File, options?: {
|
|
75
|
+
quality?: number;
|
|
76
|
+
maxWidth?: number;
|
|
77
|
+
maxHeight?: number;
|
|
78
|
+
}): Promise<void>;
|
|
79
|
+
private forceEditorUpdate;
|
|
80
|
+
private selectFileAndProcess;
|
|
81
|
+
selectAndUploadImage(editor: Editor, options?: {
|
|
82
|
+
quality?: number;
|
|
83
|
+
maxWidth?: number;
|
|
84
|
+
maxHeight?: number;
|
|
85
|
+
accept?: string;
|
|
86
|
+
}): Promise<void>;
|
|
87
|
+
selectAndReplaceImage(editor: Editor, options?: {
|
|
88
|
+
quality?: number;
|
|
89
|
+
maxWidth?: number;
|
|
90
|
+
maxHeight?: number;
|
|
91
|
+
accept?: string;
|
|
92
|
+
}): Promise<void>;
|
|
93
|
+
uploadAndReplaceImage(editor: Editor, file: File, options?: {
|
|
94
|
+
quality?: number;
|
|
95
|
+
maxWidth?: number;
|
|
96
|
+
maxHeight?: number;
|
|
97
|
+
}): Promise<void>;
|
|
98
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ImageService, never>;
|
|
99
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ImageService>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
type SupportedLocale = "en" | "fr";
|
|
103
|
+
interface TiptapTranslations {
|
|
104
|
+
toolbar: {
|
|
105
|
+
bold: string;
|
|
106
|
+
italic: string;
|
|
107
|
+
underline: string;
|
|
108
|
+
strike: string;
|
|
109
|
+
code: string;
|
|
110
|
+
superscript: string;
|
|
111
|
+
subscript: string;
|
|
112
|
+
highlight: string;
|
|
113
|
+
heading1: string;
|
|
114
|
+
heading2: string;
|
|
115
|
+
heading3: string;
|
|
116
|
+
bulletList: string;
|
|
117
|
+
orderedList: string;
|
|
118
|
+
blockquote: string;
|
|
119
|
+
alignLeft: string;
|
|
120
|
+
alignCenter: string;
|
|
121
|
+
alignRight: string;
|
|
122
|
+
alignJustify: string;
|
|
123
|
+
link: string;
|
|
124
|
+
image: string;
|
|
125
|
+
horizontalRule: string;
|
|
126
|
+
undo: string;
|
|
127
|
+
redo: string;
|
|
128
|
+
};
|
|
129
|
+
bubbleMenu: {
|
|
130
|
+
bold: string;
|
|
131
|
+
italic: string;
|
|
132
|
+
underline: string;
|
|
133
|
+
strike: string;
|
|
134
|
+
code: string;
|
|
135
|
+
superscript: string;
|
|
136
|
+
subscript: string;
|
|
137
|
+
highlight: string;
|
|
138
|
+
link: string;
|
|
139
|
+
addLink: string;
|
|
140
|
+
editLink: string;
|
|
141
|
+
removeLink: string;
|
|
142
|
+
linkUrl: string;
|
|
143
|
+
linkText: string;
|
|
144
|
+
openLink: string;
|
|
145
|
+
};
|
|
146
|
+
slashCommands: {
|
|
147
|
+
heading1: {
|
|
148
|
+
title: string;
|
|
149
|
+
description: string;
|
|
150
|
+
keywords: string[];
|
|
151
|
+
};
|
|
152
|
+
heading2: {
|
|
153
|
+
title: string;
|
|
154
|
+
description: string;
|
|
155
|
+
keywords: string[];
|
|
156
|
+
};
|
|
157
|
+
heading3: {
|
|
158
|
+
title: string;
|
|
159
|
+
description: string;
|
|
160
|
+
keywords: string[];
|
|
161
|
+
};
|
|
162
|
+
bulletList: {
|
|
163
|
+
title: string;
|
|
164
|
+
description: string;
|
|
165
|
+
keywords: string[];
|
|
166
|
+
};
|
|
167
|
+
orderedList: {
|
|
168
|
+
title: string;
|
|
169
|
+
description: string;
|
|
170
|
+
keywords: string[];
|
|
171
|
+
};
|
|
172
|
+
blockquote: {
|
|
173
|
+
title: string;
|
|
174
|
+
description: string;
|
|
175
|
+
keywords: string[];
|
|
176
|
+
};
|
|
177
|
+
code: {
|
|
178
|
+
title: string;
|
|
179
|
+
description: string;
|
|
180
|
+
keywords: string[];
|
|
181
|
+
};
|
|
182
|
+
image: {
|
|
183
|
+
title: string;
|
|
184
|
+
description: string;
|
|
185
|
+
keywords: string[];
|
|
186
|
+
};
|
|
187
|
+
horizontalRule: {
|
|
188
|
+
title: string;
|
|
189
|
+
description: string;
|
|
190
|
+
keywords: string[];
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
imageUpload: {
|
|
194
|
+
selectImage: string;
|
|
195
|
+
uploadingImage: string;
|
|
196
|
+
uploadProgress: string;
|
|
197
|
+
uploadError: string;
|
|
198
|
+
uploadSuccess: string;
|
|
199
|
+
imageTooLarge: string;
|
|
200
|
+
invalidFileType: string;
|
|
201
|
+
dragDropText: string;
|
|
202
|
+
changeImage: string;
|
|
203
|
+
deleteImage: string;
|
|
204
|
+
resizeSmall: string;
|
|
205
|
+
resizeMedium: string;
|
|
206
|
+
resizeLarge: string;
|
|
207
|
+
resizeOriginal: string;
|
|
208
|
+
};
|
|
209
|
+
editor: {
|
|
210
|
+
placeholder: string;
|
|
211
|
+
characters: string;
|
|
212
|
+
words: string;
|
|
213
|
+
imageLoadError: string;
|
|
214
|
+
linkPrompt: string;
|
|
215
|
+
linkUrlPrompt: string;
|
|
216
|
+
confirmDelete: string;
|
|
217
|
+
};
|
|
218
|
+
common: {
|
|
219
|
+
cancel: string;
|
|
220
|
+
confirm: string;
|
|
221
|
+
apply: string;
|
|
222
|
+
delete: string;
|
|
223
|
+
save: string;
|
|
224
|
+
close: string;
|
|
225
|
+
loading: string;
|
|
226
|
+
error: string;
|
|
227
|
+
success: string;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
declare class TiptapI18nService {
|
|
231
|
+
private _currentLocale;
|
|
232
|
+
private _translations;
|
|
233
|
+
readonly currentLocale: _angular_core.Signal<SupportedLocale>;
|
|
234
|
+
readonly translations: _angular_core.Signal<TiptapTranslations>;
|
|
235
|
+
readonly t: _angular_core.Signal<TiptapTranslations>;
|
|
236
|
+
readonly toolbar: _angular_core.Signal<{
|
|
237
|
+
bold: string;
|
|
238
|
+
italic: string;
|
|
239
|
+
underline: string;
|
|
240
|
+
strike: string;
|
|
241
|
+
code: string;
|
|
242
|
+
superscript: string;
|
|
243
|
+
subscript: string;
|
|
244
|
+
highlight: string;
|
|
245
|
+
heading1: string;
|
|
246
|
+
heading2: string;
|
|
247
|
+
heading3: string;
|
|
248
|
+
bulletList: string;
|
|
249
|
+
orderedList: string;
|
|
250
|
+
blockquote: string;
|
|
251
|
+
alignLeft: string;
|
|
252
|
+
alignCenter: string;
|
|
253
|
+
alignRight: string;
|
|
254
|
+
alignJustify: string;
|
|
255
|
+
link: string;
|
|
256
|
+
image: string;
|
|
257
|
+
horizontalRule: string;
|
|
258
|
+
undo: string;
|
|
259
|
+
redo: string;
|
|
260
|
+
}>;
|
|
261
|
+
readonly bubbleMenu: _angular_core.Signal<{
|
|
262
|
+
bold: string;
|
|
263
|
+
italic: string;
|
|
264
|
+
underline: string;
|
|
265
|
+
strike: string;
|
|
266
|
+
code: string;
|
|
267
|
+
superscript: string;
|
|
268
|
+
subscript: string;
|
|
269
|
+
highlight: string;
|
|
270
|
+
link: string;
|
|
271
|
+
addLink: string;
|
|
272
|
+
editLink: string;
|
|
273
|
+
removeLink: string;
|
|
274
|
+
linkUrl: string;
|
|
275
|
+
linkText: string;
|
|
276
|
+
openLink: string;
|
|
277
|
+
}>;
|
|
278
|
+
readonly slashCommands: _angular_core.Signal<{
|
|
279
|
+
heading1: {
|
|
280
|
+
title: string;
|
|
281
|
+
description: string;
|
|
282
|
+
keywords: string[];
|
|
283
|
+
};
|
|
284
|
+
heading2: {
|
|
285
|
+
title: string;
|
|
286
|
+
description: string;
|
|
287
|
+
keywords: string[];
|
|
288
|
+
};
|
|
289
|
+
heading3: {
|
|
290
|
+
title: string;
|
|
291
|
+
description: string;
|
|
292
|
+
keywords: string[];
|
|
293
|
+
};
|
|
294
|
+
bulletList: {
|
|
295
|
+
title: string;
|
|
296
|
+
description: string;
|
|
297
|
+
keywords: string[];
|
|
298
|
+
};
|
|
299
|
+
orderedList: {
|
|
300
|
+
title: string;
|
|
301
|
+
description: string;
|
|
302
|
+
keywords: string[];
|
|
303
|
+
};
|
|
304
|
+
blockquote: {
|
|
305
|
+
title: string;
|
|
306
|
+
description: string;
|
|
307
|
+
keywords: string[];
|
|
308
|
+
};
|
|
309
|
+
code: {
|
|
310
|
+
title: string;
|
|
311
|
+
description: string;
|
|
312
|
+
keywords: string[];
|
|
313
|
+
};
|
|
314
|
+
image: {
|
|
315
|
+
title: string;
|
|
316
|
+
description: string;
|
|
317
|
+
keywords: string[];
|
|
318
|
+
};
|
|
319
|
+
horizontalRule: {
|
|
320
|
+
title: string;
|
|
321
|
+
description: string;
|
|
322
|
+
keywords: string[];
|
|
323
|
+
};
|
|
324
|
+
}>;
|
|
325
|
+
readonly imageUpload: _angular_core.Signal<{
|
|
326
|
+
selectImage: string;
|
|
327
|
+
uploadingImage: string;
|
|
328
|
+
uploadProgress: string;
|
|
329
|
+
uploadError: string;
|
|
330
|
+
uploadSuccess: string;
|
|
331
|
+
imageTooLarge: string;
|
|
332
|
+
invalidFileType: string;
|
|
333
|
+
dragDropText: string;
|
|
334
|
+
changeImage: string;
|
|
335
|
+
deleteImage: string;
|
|
336
|
+
resizeSmall: string;
|
|
337
|
+
resizeMedium: string;
|
|
338
|
+
resizeLarge: string;
|
|
339
|
+
resizeOriginal: string;
|
|
340
|
+
}>;
|
|
341
|
+
readonly editor: _angular_core.Signal<{
|
|
342
|
+
placeholder: string;
|
|
343
|
+
characters: string;
|
|
344
|
+
words: string;
|
|
345
|
+
imageLoadError: string;
|
|
346
|
+
linkPrompt: string;
|
|
347
|
+
linkUrlPrompt: string;
|
|
348
|
+
confirmDelete: string;
|
|
349
|
+
}>;
|
|
350
|
+
readonly common: _angular_core.Signal<{
|
|
351
|
+
cancel: string;
|
|
352
|
+
confirm: string;
|
|
353
|
+
apply: string;
|
|
354
|
+
delete: string;
|
|
355
|
+
save: string;
|
|
356
|
+
close: string;
|
|
357
|
+
loading: string;
|
|
358
|
+
error: string;
|
|
359
|
+
success: string;
|
|
360
|
+
}>;
|
|
361
|
+
constructor();
|
|
362
|
+
setLocale(locale: SupportedLocale): void;
|
|
363
|
+
autoDetectLocale(): void;
|
|
364
|
+
getSupportedLocales(): SupportedLocale[];
|
|
365
|
+
addTranslations(locale: SupportedLocale, translations: Partial<TiptapTranslations>): void;
|
|
366
|
+
private detectBrowserLanguage;
|
|
367
|
+
getToolbarTitle(key: keyof TiptapTranslations["toolbar"]): string;
|
|
368
|
+
getBubbleMenuTitle(key: keyof TiptapTranslations["bubbleMenu"]): string;
|
|
369
|
+
getSlashCommand(key: keyof TiptapTranslations["slashCommands"]): {
|
|
370
|
+
title: string;
|
|
371
|
+
description: string;
|
|
372
|
+
keywords: string[];
|
|
373
|
+
} | {
|
|
374
|
+
title: string;
|
|
375
|
+
description: string;
|
|
376
|
+
keywords: string[];
|
|
377
|
+
} | {
|
|
378
|
+
title: string;
|
|
379
|
+
description: string;
|
|
380
|
+
keywords: string[];
|
|
381
|
+
} | {
|
|
382
|
+
title: string;
|
|
383
|
+
description: string;
|
|
384
|
+
keywords: string[];
|
|
385
|
+
} | {
|
|
386
|
+
title: string;
|
|
387
|
+
description: string;
|
|
388
|
+
keywords: string[];
|
|
389
|
+
} | {
|
|
390
|
+
title: string;
|
|
391
|
+
description: string;
|
|
392
|
+
keywords: string[];
|
|
393
|
+
} | {
|
|
394
|
+
title: string;
|
|
395
|
+
description: string;
|
|
396
|
+
keywords: string[];
|
|
397
|
+
} | {
|
|
398
|
+
title: string;
|
|
399
|
+
description: string;
|
|
400
|
+
keywords: string[];
|
|
401
|
+
} | {
|
|
402
|
+
title: string;
|
|
403
|
+
description: string;
|
|
404
|
+
keywords: string[];
|
|
405
|
+
};
|
|
406
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TiptapI18nService, never>;
|
|
407
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<TiptapI18nService>;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
interface ToolbarConfig {
|
|
411
|
+
bold?: boolean;
|
|
412
|
+
italic?: boolean;
|
|
413
|
+
underline?: boolean;
|
|
414
|
+
strike?: boolean;
|
|
415
|
+
code?: boolean;
|
|
416
|
+
superscript?: boolean;
|
|
417
|
+
subscript?: boolean;
|
|
418
|
+
highlight?: boolean;
|
|
419
|
+
heading1?: boolean;
|
|
420
|
+
heading2?: boolean;
|
|
421
|
+
heading3?: boolean;
|
|
422
|
+
bulletList?: boolean;
|
|
423
|
+
orderedList?: boolean;
|
|
424
|
+
blockquote?: boolean;
|
|
425
|
+
alignLeft?: boolean;
|
|
426
|
+
alignCenter?: boolean;
|
|
427
|
+
alignRight?: boolean;
|
|
428
|
+
alignJustify?: boolean;
|
|
429
|
+
link?: boolean;
|
|
430
|
+
image?: boolean;
|
|
431
|
+
horizontalRule?: boolean;
|
|
432
|
+
undo?: boolean;
|
|
433
|
+
redo?: boolean;
|
|
434
|
+
separator?: boolean;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
interface BubbleMenuConfig {
|
|
438
|
+
bold?: boolean;
|
|
439
|
+
italic?: boolean;
|
|
440
|
+
underline?: boolean;
|
|
441
|
+
strike?: boolean;
|
|
442
|
+
code?: boolean;
|
|
443
|
+
superscript?: boolean;
|
|
444
|
+
subscript?: boolean;
|
|
445
|
+
highlight?: boolean;
|
|
446
|
+
link?: boolean;
|
|
447
|
+
separator?: boolean;
|
|
448
|
+
}
|
|
449
|
+
interface ImageBubbleMenuConfig {
|
|
450
|
+
changeImage?: boolean;
|
|
451
|
+
resizeSmall?: boolean;
|
|
452
|
+
resizeMedium?: boolean;
|
|
453
|
+
resizeLarge?: boolean;
|
|
454
|
+
resizeOriginal?: boolean;
|
|
455
|
+
deleteImage?: boolean;
|
|
456
|
+
separator?: boolean;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
declare const DEFAULT_TOOLBAR_CONFIG: ToolbarConfig;
|
|
460
|
+
declare const DEFAULT_BUBBLE_MENU_CONFIG: BubbleMenuConfig;
|
|
461
|
+
declare const DEFAULT_IMAGE_BUBBLE_MENU_CONFIG: ImageBubbleMenuConfig;
|
|
462
|
+
declare class AngularTiptapEditorComponent implements OnInit, AfterViewInit, OnDestroy, ControlValueAccessor {
|
|
463
|
+
private imageService;
|
|
464
|
+
content: _angular_core.InputSignal<string>;
|
|
465
|
+
placeholder: _angular_core.InputSignal<string>;
|
|
466
|
+
editable: _angular_core.InputSignal<boolean>;
|
|
467
|
+
minHeight: _angular_core.InputSignal<number>;
|
|
468
|
+
height: _angular_core.InputSignal<number | undefined>;
|
|
469
|
+
maxHeight: _angular_core.InputSignal<number | undefined>;
|
|
470
|
+
showToolbar: _angular_core.InputSignal<boolean>;
|
|
471
|
+
showCharacterCount: _angular_core.InputSignal<boolean>;
|
|
472
|
+
maxCharacters: _angular_core.InputSignal<number | undefined>;
|
|
473
|
+
enableOfficePaste: _angular_core.InputSignal<boolean>;
|
|
474
|
+
enableSlashCommands: _angular_core.InputSignal<boolean>;
|
|
475
|
+
slashCommandsConfig: _angular_core.InputSignal<SlashCommandsConfig | undefined>;
|
|
476
|
+
locale: _angular_core.InputSignal<SupportedLocale | undefined>;
|
|
477
|
+
showBubbleMenu: _angular_core.InputSignal<boolean>;
|
|
478
|
+
bubbleMenu: _angular_core.InputSignal<Partial<BubbleMenuConfig>>;
|
|
479
|
+
showImageBubbleMenu: _angular_core.InputSignal<boolean>;
|
|
480
|
+
imageBubbleMenu: _angular_core.InputSignal<Partial<ImageBubbleMenuConfig>>;
|
|
481
|
+
toolbar: _angular_core.InputSignal<Partial<ToolbarConfig>>;
|
|
482
|
+
imageUpload: _angular_core.InputSignal<Partial<any>>;
|
|
483
|
+
contentChange: _angular_core.OutputEmitterRef<string>;
|
|
484
|
+
editorCreated: _angular_core.OutputEmitterRef<Editor>;
|
|
485
|
+
editorUpdate: _angular_core.OutputEmitterRef<{
|
|
486
|
+
editor: Editor;
|
|
487
|
+
transaction: any;
|
|
488
|
+
}>;
|
|
489
|
+
editorFocus: _angular_core.OutputEmitterRef<{
|
|
490
|
+
editor: Editor;
|
|
491
|
+
event: FocusEvent;
|
|
492
|
+
}>;
|
|
493
|
+
editorBlur: _angular_core.OutputEmitterRef<{
|
|
494
|
+
editor: Editor;
|
|
495
|
+
event: FocusEvent;
|
|
496
|
+
}>;
|
|
497
|
+
editorElement: _angular_core.Signal<ElementRef<any>>;
|
|
498
|
+
editor: _angular_core.WritableSignal<Editor | null>;
|
|
499
|
+
characterCountData: _angular_core.WritableSignal<{
|
|
500
|
+
characters: number;
|
|
501
|
+
words: number;
|
|
502
|
+
} | null>;
|
|
503
|
+
isDragOver: _angular_core.WritableSignal<boolean>;
|
|
504
|
+
editorFullyInitialized: _angular_core.WritableSignal<boolean>;
|
|
505
|
+
isEditorReady: _angular_core.Signal<boolean>;
|
|
506
|
+
toolbarConfig: _angular_core.Signal<ToolbarConfig>;
|
|
507
|
+
bubbleMenuConfig: _angular_core.Signal<BubbleMenuConfig>;
|
|
508
|
+
imageBubbleMenuConfig: _angular_core.Signal<ImageBubbleMenuConfig>;
|
|
509
|
+
imageUploadConfig: _angular_core.Signal<{
|
|
510
|
+
maxSize: number;
|
|
511
|
+
maxWidth: number;
|
|
512
|
+
maxHeight: number;
|
|
513
|
+
allowedTypes: string[];
|
|
514
|
+
enableDragDrop: boolean;
|
|
515
|
+
showPreview: boolean;
|
|
516
|
+
multiple: boolean;
|
|
517
|
+
compressImages: boolean;
|
|
518
|
+
quality: number;
|
|
519
|
+
}>;
|
|
520
|
+
slashCommandsConfigComputed: _angular_core.Signal<SlashCommandsConfig>;
|
|
521
|
+
private onChange;
|
|
522
|
+
private onTouched;
|
|
523
|
+
readonly i18nService: TiptapI18nService;
|
|
524
|
+
constructor(imageService: ImageService);
|
|
525
|
+
ngOnInit(): void;
|
|
526
|
+
ngAfterViewInit(): void;
|
|
527
|
+
ngOnDestroy(): void;
|
|
528
|
+
private initEditor;
|
|
529
|
+
private updateCharacterCount;
|
|
530
|
+
onImageUploaded(result: ImageUploadResult): void;
|
|
531
|
+
onImageUploadError(error: string): void;
|
|
532
|
+
onSlashCommandImageUpload(file: File): Promise<void>;
|
|
533
|
+
onDragOver(event: DragEvent): void;
|
|
534
|
+
onDrop(event: DragEvent): void;
|
|
535
|
+
private insertImageFromFile;
|
|
536
|
+
getHTML(): string;
|
|
537
|
+
getJSON(): any;
|
|
538
|
+
getText(): string;
|
|
539
|
+
setContent(content: string, emitUpdate?: boolean): void;
|
|
540
|
+
focus(): void;
|
|
541
|
+
blur(): void;
|
|
542
|
+
clearContent(): void;
|
|
543
|
+
writeValue(value: string): void;
|
|
544
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
545
|
+
registerOnTouched(fn: () => void): void;
|
|
546
|
+
setDisabledState(isDisabled: boolean): void;
|
|
547
|
+
onEditorClick(event: MouseEvent): void;
|
|
548
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AngularTiptapEditorComponent, never>;
|
|
549
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AngularTiptapEditorComponent, "angular-tiptap-editor", never, { "content": { "alias": "content"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "editable": { "alias": "editable"; "required": false; "isSignal": true; }; "minHeight": { "alias": "minHeight"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "showToolbar": { "alias": "showToolbar"; "required": false; "isSignal": true; }; "showCharacterCount": { "alias": "showCharacterCount"; "required": false; "isSignal": true; }; "maxCharacters": { "alias": "maxCharacters"; "required": false; "isSignal": true; }; "enableOfficePaste": { "alias": "enableOfficePaste"; "required": false; "isSignal": true; }; "enableSlashCommands": { "alias": "enableSlashCommands"; "required": false; "isSignal": true; }; "slashCommandsConfig": { "alias": "slashCommandsConfig"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "showBubbleMenu": { "alias": "showBubbleMenu"; "required": false; "isSignal": true; }; "bubbleMenu": { "alias": "bubbleMenu"; "required": false; "isSignal": true; }; "showImageBubbleMenu": { "alias": "showImageBubbleMenu"; "required": false; "isSignal": true; }; "imageBubbleMenu": { "alias": "imageBubbleMenu"; "required": false; "isSignal": true; }; "toolbar": { "alias": "toolbar"; "required": false; "isSignal": true; }; "imageUpload": { "alias": "imageUpload"; "required": false; "isSignal": true; }; }, { "contentChange": "contentChange"; "editorCreated": "editorCreated"; "editorUpdate": "editorUpdate"; "editorFocus": "editorFocus"; "editorBlur": "editorBlur"; }, never, never, true, never>;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Factory function pour créer les slash commands traduits
|
|
554
|
+
*/
|
|
555
|
+
declare function createI18nSlashCommands(i18nService: TiptapI18nService): SlashCommandItem[];
|
|
556
|
+
|
|
557
|
+
type HeightConfig = {
|
|
558
|
+
minHeight?: number;
|
|
559
|
+
height?: number;
|
|
560
|
+
maxHeight?: number;
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
export { AngularTiptapEditorComponent, DEFAULT_BUBBLE_MENU_CONFIG, DEFAULT_IMAGE_BUBBLE_MENU_CONFIG, DEFAULT_SLASH_COMMANDS, DEFAULT_TOOLBAR_CONFIG, TiptapI18nService, createI18nSlashCommands };
|
|
564
|
+
export type { BubbleMenuConfig, HeightConfig, ImageBubbleMenuConfig, SlashCommandItem, SlashCommandsConfig, SupportedLocale, TiptapTranslations, ToolbarConfig };
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flogeez/angular-tiptap-editor",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A modern, customizable rich-text editor for Angular (19+), built with Tiptap and featuring complete internationalization support",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"angular",
|
|
7
|
+
"tiptap",
|
|
8
|
+
"editor",
|
|
9
|
+
"rich-text",
|
|
10
|
+
"wysiwyg",
|
|
11
|
+
"typescript",
|
|
12
|
+
"i18n",
|
|
13
|
+
"internationalization"
|
|
14
|
+
],
|
|
15
|
+
"author": "FloGeez",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/FloGeez/angular-tiptap-editor.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/FloGeez/angular-tiptap-editor/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://flogeez.github.io/angular-tiptap-editor/",
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@angular/common": ">=19.0.0",
|
|
27
|
+
"@angular/core": ">=19.0.0",
|
|
28
|
+
"@angular/forms": ">=19.0.0",
|
|
29
|
+
"@tiptap/core": "^2.0.0",
|
|
30
|
+
"@tiptap/starter-kit": "^2.0.0",
|
|
31
|
+
"@tiptap/extension-placeholder": "^2.0.0",
|
|
32
|
+
"@tiptap/extension-character-count": "^2.0.0",
|
|
33
|
+
"@tiptap/extension-bubble-menu": "^2.0.0",
|
|
34
|
+
"@tiptap/extension-underline": "^2.0.0",
|
|
35
|
+
"@tiptap/extension-superscript": "^2.0.0",
|
|
36
|
+
"@tiptap/extension-subscript": "^2.0.0",
|
|
37
|
+
"@tiptap/extension-text-align": "^2.0.0",
|
|
38
|
+
"@tiptap/extension-link": "^2.0.0",
|
|
39
|
+
"@tiptap/extension-highlight": "^2.0.0",
|
|
40
|
+
"@intevation/tiptap-extension-office-paste": "^0.1.0",
|
|
41
|
+
"tippy.js": "^6.3.7"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"tslib": "^2.3.0"
|
|
45
|
+
},
|
|
46
|
+
"sideEffects": false,
|
|
47
|
+
"module": "fesm2022/flogeez-angular-tiptap-editor.mjs",
|
|
48
|
+
"typings": "index.d.ts",
|
|
49
|
+
"exports": {
|
|
50
|
+
"./package.json": {
|
|
51
|
+
"default": "./package.json"
|
|
52
|
+
},
|
|
53
|
+
".": {
|
|
54
|
+
"types": "./index.d.ts",
|
|
55
|
+
"default": "./fesm2022/flogeez-angular-tiptap-editor.mjs"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* Styles globaux pour les menus contextuels Tiptap */
|
|
2
|
+
.tippy-box .bubble-menu {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 6px;
|
|
6
|
+
background: rgba(255, 255, 255, 0.95);
|
|
7
|
+
backdrop-filter: blur(12px);
|
|
8
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
9
|
+
border-radius: 16px;
|
|
10
|
+
padding: 8px 12px;
|
|
11
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
|
|
12
|
+
z-index: 1000;
|
|
13
|
+
animation: slideUp 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.bubble-menu .tiptap-separator {
|
|
17
|
+
width: 1px;
|
|
18
|
+
height: 28px;
|
|
19
|
+
background: linear-gradient(to bottom, transparent, #e2e8f0, transparent);
|
|
20
|
+
margin: 0 4px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes slideUp {
|
|
24
|
+
from {
|
|
25
|
+
opacity: 0;
|
|
26
|
+
transform: translateY(8px) scale(0.95);
|
|
27
|
+
}
|
|
28
|
+
to {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
transform: translateY(0) scale(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@import "./bubble-menu.global.css";
|
|
2
|
+
|
|
3
|
+
/* Styles pour les liens */
|
|
4
|
+
.tiptap-link {
|
|
5
|
+
color: #3b82f6;
|
|
6
|
+
text-decoration: underline;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
transition: color 0.2s ease;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.tiptap-link:hover {
|
|
12
|
+
color: #1d4ed8;
|
|
13
|
+
text-decoration: underline;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Styles pour la surbrillance */
|
|
17
|
+
.tiptap-highlight {
|
|
18
|
+
background-color: #fef08a;
|
|
19
|
+
padding: 0.1em 0.2em;
|
|
20
|
+
border-radius: 2px;
|
|
21
|
+
color: #854d0e;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Styles pour les alignements de texte */
|
|
25
|
+
.tiptap-editor p[style*="text-align: center"] {
|
|
26
|
+
text-align: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.tiptap-editor p[style*="text-align: right"] {
|
|
30
|
+
text-align: right;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.tiptap-editor p[style*="text-align: justify"] {
|
|
34
|
+
text-align: justify;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.tiptap-editor h1[style*="text-align: center"],
|
|
38
|
+
.tiptap-editor h2[style*="text-align: center"],
|
|
39
|
+
.tiptap-editor h3[style*="text-align: center"] {
|
|
40
|
+
text-align: center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.tiptap-editor h1[style*="text-align: right"],
|
|
44
|
+
.tiptap-editor h2[style*="text-align: right"],
|
|
45
|
+
.tiptap-editor h3[style*="text-align: right"] {
|
|
46
|
+
text-align: right;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.tiptap-editor h1[style*="text-align: justify"],
|
|
50
|
+
.tiptap-editor h2[style*="text-align: justify"],
|
|
51
|
+
.tiptap-editor h3[style*="text-align: justify"] {
|
|
52
|
+
text-align: justify;
|
|
53
|
+
}
|