@flogeez/angular-tiptap-editor 2.1.3 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -1
- package/README.md +46 -42
- package/fesm2022/flogeez-angular-tiptap-editor.mjs +597 -477
- package/fesm2022/flogeez-angular-tiptap-editor.mjs.map +1 -1
- package/index.d.ts +195 -181
- package/package.json +1 -1
- package/src/lib/styles/{bubble-menu.global.css → ate-bubble-menu.global.css} +1 -1
- package/src/lib/styles/index.css +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,36 @@
|
|
|
3
3
|
All notable changes to `@flogeez/angular-tiptap-editor` will be documented in this file.
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), with the exception that the major version is specifically aligned with the major version of [Tiptap](https://tiptap.dev).
|
|
7
|
+
|
|
8
|
+
## [2.2.1] - 2026-01-25
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Custom Menu Items**: Added support for custom items in both the `Toolbar` and the `Bubble Menu` via the `custom` property in `AteToolbarConfig` and `AteBubbleMenuConfig`. This allows developers to easily extend the editor's UI with project-specific actions.
|
|
13
|
+
|
|
14
|
+
## [2.2.0] - 2026-01-21
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **Internal Ecosystem Prefixing**: Systemic renaming of all internal classes, services, models, and constants to use the `Ate` or `ATE_` prefix (e.g., `AteI18nService`, `AteEditorCommandsService`, `ATE_INITIAL_EDITOR_STATE`). This provides better library identification and avoids collisions with third-party extensions.
|
|
19
|
+
- **UI Branding Refactoring**: Refactored internal component selectors and CSS classes to use the new `ate-` prefix (e.g., `ate-button`, `ate-toolbar`). The main editor selector remains `angular-tiptap-editor`.
|
|
20
|
+
- **Project Standards**: Enforced Unix-style line endings (**LF**) across the entire repository via `.gitattributes` to ensure cross-platform consistency.
|
|
21
|
+
|
|
22
|
+
### Breaking Changes
|
|
23
|
+
|
|
24
|
+
- **Renamed Public Exports**: Systemal renaming of internal library exports to use the `Ate` prefix. **Backward compatibility is maintained** via deprecated aliases for all renamed items, which will be removed in v3.0.0.
|
|
25
|
+
- `EditorCommandsService` -> `AteEditorCommandsService`
|
|
26
|
+
- `TiptapI18nService` -> `AteI18nService`
|
|
27
|
+
- `EditorStateSnapshot` -> `AteEditorStateSnapshot`
|
|
28
|
+
- `INITIAL_EDITOR_STATE` -> `ATE_INITIAL_EDITOR_STATE`
|
|
29
|
+
- `ToolbarConfig` -> `AteToolbarConfig`, etc.
|
|
30
|
+
- All TipTap extensions (e.g., `AteResizableImage`, `AteTiptapStateExtension`).
|
|
31
|
+
- **Internal Component Selectors**: If you were using internal library components directly in your templates (outside of the main editor), they now use the `ate-` prefix:
|
|
32
|
+
- `tiptap-toolbar` -> `ate-toolbar`
|
|
33
|
+
- `tiptap-button` -> `ate-button`
|
|
34
|
+
- `tiptap-bubble-menu` -> `ate-bubble-menu`
|
|
35
|
+
- **Main Editor Selector**: Unchanged (`angular-tiptap-editor`), preserving the existing facade.
|
|
7
36
|
|
|
8
37
|
## [2.1.3] - 2026-01-21
|
|
9
38
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A modern, customizable rich-text editor for Angular applications, built with Tiptap and featuring complete internationalization support.
|
|
4
4
|
|
|
5
|
-
[](https://flogeez.github.io/angular-tiptap-editor/) [](https://stackblitz.com/edit/angular-tiptap-editor)
|
|
5
|
+
[](https://www.npmjs.com/package/@flogeez/angular-tiptap-editor) [](https://flogeez.github.io/angular-tiptap-editor/) [](https://stackblitz.com/edit/angular-tiptap-editor)
|
|
6
6
|
|
|
7
7
|
## 🚀 Features
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ A modern, customizable rich-text editor for Angular applications, built with Tip
|
|
|
16
16
|
- **Built-in i18n**: English & French support with a reactive, extensible locale system.
|
|
17
17
|
- **Word/Character Count**: Real-time statistics with proper pluralization support.
|
|
18
18
|
- **Office-Ready**: Cleaned-up pasting from Microsoft Word and Excel to maintain layout integrity.
|
|
19
|
-
- **Service Driven**: Deep programmatic control via `
|
|
19
|
+
- **Service Driven**: Deep programmatic control via `AteEditorCommandsService` and isolated instances.
|
|
20
20
|
- **A11y First**: Built with accessibility best practices and full keyboard navigation.
|
|
21
21
|
|
|
22
22
|
## 💎 Why this editor?
|
|
@@ -87,7 +87,11 @@ The editor can be fully configured using a single `[config]` object, which provi
|
|
|
87
87
|
|
|
88
88
|
```typescript
|
|
89
89
|
import { Component } from "@angular/core";
|
|
90
|
-
import {
|
|
90
|
+
import {
|
|
91
|
+
AngularTiptapEditorComponent,
|
|
92
|
+
AteEditorConfig,
|
|
93
|
+
ATE_DEFAULT_TOOLBAR_CONFIG,
|
|
94
|
+
} from "@flogeez/angular-tiptap-editor";
|
|
91
95
|
|
|
92
96
|
@Component({
|
|
93
97
|
selector: "app-advanced",
|
|
@@ -109,7 +113,7 @@ export class AdvancedComponent {
|
|
|
109
113
|
|
|
110
114
|
// Customize the toolbar by enabling specific features
|
|
111
115
|
toolbar: {
|
|
112
|
-
...
|
|
116
|
+
...ATE_DEFAULT_TOOLBAR_CONFIG,
|
|
113
117
|
clear: true, // Enable the 'Clear' button
|
|
114
118
|
highlight: false, // Disable the highlight button
|
|
115
119
|
},
|
|
@@ -187,7 +191,7 @@ export class FormComponent {
|
|
|
187
191
|
|
|
188
192
|
```typescript
|
|
189
193
|
import { Component, inject } from "@angular/core";
|
|
190
|
-
import {
|
|
194
|
+
import { AteEditorCommandsService } from "@flogeez/angular-tiptap-editor";
|
|
191
195
|
|
|
192
196
|
@Component({
|
|
193
197
|
selector: "app-commands",
|
|
@@ -205,7 +209,7 @@ import { EditorCommandsService } from "@flogeez/angular-tiptap-editor";
|
|
|
205
209
|
`,
|
|
206
210
|
})
|
|
207
211
|
export class CommandsComponent {
|
|
208
|
-
private editorCommandsService = inject(
|
|
212
|
+
private editorCommandsService = inject(AteEditorCommandsService);
|
|
209
213
|
private editor: Editor | null = null;
|
|
210
214
|
|
|
211
215
|
onEditorCreated(editor: Editor) {
|
|
@@ -247,13 +251,13 @@ Any TipTap **Mark** or **Node** you add to `tiptapExtensions` is automatically t
|
|
|
247
251
|
|
|
248
252
|
If you need to extract complex data (like attributes, depth, or custom logic), you can provide a custom `StateCalculator`.
|
|
249
253
|
|
|
250
|
-
1.
|
|
254
|
+
1. **Define a Calculator**:
|
|
251
255
|
|
|
252
256
|
```typescript
|
|
253
|
-
import {
|
|
257
|
+
import { AteStateCalculator } from "@flogeez/angular-tiptap-editor";
|
|
254
258
|
|
|
255
259
|
// This function will be called on every editor update
|
|
256
|
-
export const MyCustomCalculator:
|
|
260
|
+
export const MyCustomCalculator: AteStateCalculator = editor => {
|
|
257
261
|
return {
|
|
258
262
|
custom: {
|
|
259
263
|
hasHighPriority: editor.isActive("priority"),
|
|
@@ -264,18 +268,18 @@ export const MyCustomCalculator: StateCalculator = editor => {
|
|
|
264
268
|
};
|
|
265
269
|
```
|
|
266
270
|
|
|
267
|
-
2.
|
|
271
|
+
2. **Register it in the Template**:
|
|
268
272
|
|
|
269
273
|
```html
|
|
270
274
|
<angular-tiptap-editor [stateCalculators]="[MyCustomCalculator]" />
|
|
271
275
|
```
|
|
272
276
|
|
|
273
|
-
3.
|
|
277
|
+
3. **Consume it anywhere**:
|
|
274
278
|
|
|
275
279
|
```typescript
|
|
276
280
|
@Component({ ... })
|
|
277
281
|
export class MyToolbarComponent {
|
|
278
|
-
private editorCommands = inject(
|
|
282
|
+
private editorCommands = inject(AteEditorCommandsService);
|
|
279
283
|
|
|
280
284
|
// Access your custom data reactively!
|
|
281
285
|
isHighPriority = computed(() => this.editorCommands.editorState().custom?.hasHighPriority);
|
|
@@ -309,9 +313,9 @@ Quick content insertion with slash commands:
|
|
|
309
313
|
The `slashCommands` object also allows you to add completely custom command items:
|
|
310
314
|
|
|
311
315
|
```typescript
|
|
312
|
-
import {
|
|
316
|
+
import { AteSlashCommandsConfig } from "@flogeez/angular-tiptap-editor";
|
|
313
317
|
|
|
314
|
-
slashCommands:
|
|
318
|
+
slashCommands: AteSlashCommandsConfig = {
|
|
315
319
|
// Toggle native commands
|
|
316
320
|
heading1: true,
|
|
317
321
|
image: false,
|
|
@@ -351,7 +355,7 @@ The handler can return either an **Observable** or a **Promise**.
|
|
|
351
355
|
import { Component, inject } from "@angular/core";
|
|
352
356
|
import { HttpClient } from "@angular/common/http";
|
|
353
357
|
import { map } from "rxjs/operators";
|
|
354
|
-
import { AngularTiptapEditorComponent,
|
|
358
|
+
import { AngularTiptapEditorComponent, AteImageUploadHandler } from "@flogeez/angular-tiptap-editor";
|
|
355
359
|
|
|
356
360
|
@Component({
|
|
357
361
|
selector: "app-custom-upload",
|
|
@@ -368,7 +372,7 @@ export class CustomUploadComponent {
|
|
|
368
372
|
private http = inject(HttpClient);
|
|
369
373
|
content = "";
|
|
370
374
|
|
|
371
|
-
uploadHandler:
|
|
375
|
+
uploadHandler: AteImageUploadHandler = ctx => {
|
|
372
376
|
const formData = new FormData();
|
|
373
377
|
formData.append("image", ctx.file);
|
|
374
378
|
|
|
@@ -384,7 +388,7 @@ export class CustomUploadComponent {
|
|
|
384
388
|
#### Using Promise (async/await)
|
|
385
389
|
|
|
386
390
|
```typescript
|
|
387
|
-
uploadHandler:
|
|
391
|
+
uploadHandler: AteImageUploadHandler = async ctx => {
|
|
388
392
|
const formData = new FormData();
|
|
389
393
|
formData.append("image", ctx.file);
|
|
390
394
|
|
|
@@ -463,11 +467,11 @@ Open [http://localhost:4200](http://localhost:4200) to view the demo.
|
|
|
463
467
|
| `enableOfficePaste` | `boolean` | `true` | Enable smart Office pasting |
|
|
464
468
|
| `showCharacterCount` | `boolean` | `true` | Show character counter |
|
|
465
469
|
| `showWordCount` | `boolean` | `true` | Show word counter |
|
|
466
|
-
| `toolbar` | `
|
|
467
|
-
| `bubbleMenu` | `
|
|
468
|
-
| `slashCommands` | `
|
|
469
|
-
| `imageUploadHandler` | `
|
|
470
|
-
| `stateCalculators` | `
|
|
470
|
+
| `toolbar` | `AteToolbarConfig` | All enabled | Detailed toolbar configuration |
|
|
471
|
+
| `bubbleMenu` | `AteBubbleMenuConfig` | All enabled | Detailed bubble menu configuration |
|
|
472
|
+
| `slashCommands` | `AteSlashCommandsConfig` | All enabled | Detailed slash commands config |
|
|
473
|
+
| `imageUploadHandler` | `AteImageUploadHandler` | `undefined` | Custom image upload function |
|
|
474
|
+
| `stateCalculators` | `AteStateCalculator[]` | `[]` | Custom reactive state logic |
|
|
471
475
|
| `tiptapExtensions` | `(Extension \| Node \| Mark)[]` | `[]` | Additional Tiptap extensions |
|
|
472
476
|
| `tiptapOptions` | `Partial<EditorOptions>` | `{}` | Additional Tiptap editor options |
|
|
473
477
|
|
|
@@ -507,12 +511,12 @@ export interface AteEditorConfig {
|
|
|
507
511
|
maxCharacters?: number;
|
|
508
512
|
|
|
509
513
|
// Complex Modules
|
|
510
|
-
toolbar?:
|
|
511
|
-
bubbleMenu?:
|
|
512
|
-
imageBubbleMenu?:
|
|
513
|
-
tableBubbleMenu?:
|
|
514
|
-
cellBubbleMenu?:
|
|
515
|
-
slashCommands?:
|
|
514
|
+
toolbar?: AteToolbarConfig;
|
|
515
|
+
bubbleMenu?: AteBubbleMenuConfig;
|
|
516
|
+
imageBubbleMenu?: AteImageBubbleMenuConfig;
|
|
517
|
+
tableBubbleMenu?: AteTableBubbleMenuConfig;
|
|
518
|
+
cellBubbleMenu?: AteCellBubbleMenuConfig;
|
|
519
|
+
slashCommands?: AteSlashCommandsConfig;
|
|
516
520
|
imageUpload?: AteImageUploadConfig;
|
|
517
521
|
}
|
|
518
522
|
```
|
|
@@ -524,7 +528,7 @@ The `imageUpload` property in `AteEditorConfig` provides fine-grained control ov
|
|
|
524
528
|
```typescript
|
|
525
529
|
export interface AteImageUploadConfig {
|
|
526
530
|
/** Custom handler to upload files to a server */
|
|
527
|
-
handler?:
|
|
531
|
+
handler?: AteImageUploadHandler;
|
|
528
532
|
/** Maximum file size in bytes (default: 10MB) */
|
|
529
533
|
maxFileSize?: number;
|
|
530
534
|
/** Accepted file types (default: 'image/*') */
|
|
@@ -560,14 +564,14 @@ The editor comes with built-in support for **English (en)** and **French (fr)**,
|
|
|
560
564
|
|
|
561
565
|
### Adding Custom Languages
|
|
562
566
|
|
|
563
|
-
You can easily extend the editor with new languages or override existing labels using the `
|
|
567
|
+
You can easily extend the editor with new languages or override existing labels using the `AteI18nService`:
|
|
564
568
|
|
|
565
569
|
```typescript
|
|
566
|
-
import {
|
|
570
|
+
import { AteI18nService } from "@flogeez/angular-tiptap-editor";
|
|
567
571
|
|
|
568
572
|
@Component({ ... })
|
|
569
573
|
export class MyComponent {
|
|
570
|
-
constructor(private i18nService:
|
|
574
|
+
constructor(private i18nService: AteI18nService) {
|
|
571
575
|
// Add Spanish support
|
|
572
576
|
this.i18nService.addTranslations('es', {
|
|
573
577
|
toolbar: { bold: 'Negrita', italic: 'Cursiva', ... },
|
|
@@ -651,7 +655,7 @@ angular-tiptap-editor {
|
|
|
651
655
|
|
|
652
656
|
### ⚡ Reactive State & OnPush
|
|
653
657
|
|
|
654
|
-
The library exposes a reactive `editorState` signal via the `
|
|
658
|
+
The library exposes a reactive `editorState` signal via the `AteEditorCommandsService`. This signal contains everything you need to build custom UIs around the editor:
|
|
655
659
|
|
|
656
660
|
- **Active State**: Check if `bold`, `italic`, or custom marks are active.
|
|
657
661
|
- **Commands Availability**: Check if `undo`, `redo`, or custom commands can be executed.
|
|
@@ -686,13 +690,13 @@ The library uses a **Snapshot & Signal** pattern to bridge Tiptap and Angular.
|
|
|
686
690
|
|
|
687
691
|
### Core Services
|
|
688
692
|
|
|
689
|
-
- **`
|
|
690
|
-
- **`
|
|
691
|
-
- **`
|
|
693
|
+
- **`AteEditorCommandsService`**: Exposes the `editorState` signal and provides a centralized API for executing Tiptap commands.
|
|
694
|
+
- **`AteImageService`**: Manages the image processing pipeline (selection, compression, and server-side upload handling).
|
|
695
|
+
- **`AteI18nService`**: Reactive translation service with support for browser locale auto-detection.
|
|
692
696
|
|
|
693
697
|
### Isolated Instances
|
|
694
698
|
|
|
695
|
-
Each component instance provides its own set of services (`
|
|
699
|
+
Each component instance provides its own set of services (`AteEditorCommandsService`, `AteImageService`, etc.) at the component level. This ensures that multiple editors on the same page maintain independent states and configurations without interference.
|
|
696
700
|
|
|
697
701
|
### Modern Angular Integration
|
|
698
702
|
|
|
@@ -706,11 +710,11 @@ The library provides default configurations that can be imported and customized:
|
|
|
706
710
|
|
|
707
711
|
```typescript
|
|
708
712
|
import {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
713
|
+
ATE_DEFAULT_TOOLBAR_CONFIG,
|
|
714
|
+
ATE_DEFAULT_BUBBLE_MENU_CONFIG,
|
|
715
|
+
ATE_DEFAULT_IMAGE_BUBBLE_MENU_CONFIG,
|
|
716
|
+
ATE_DEFAULT_TABLE_MENU_CONFIG,
|
|
717
|
+
ATE_DEFAULT_SLASH_COMMANDS_CONFIG,
|
|
714
718
|
} from "@flogeez/angular-tiptap-editor";
|
|
715
719
|
```
|
|
716
720
|
|