@flogeez/angular-tiptap-editor 0.3.7 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,141 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@flogeez/angular-tiptap-editor` will be documented in this file.
4
+
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).
7
+
8
+ ## [0.5.0] - 2026-01-07
9
+
10
+ ### Added
11
+ - **Full Theming System**: Introduced a complete set of CSS variables (`--ate-*`) for deep editor customization.
12
+ - **Dark Mode Support**: Native support for dark mode via `.dark` class or `[data-theme="dark"]` attribute on the editor component.
13
+ - **Theme Customizer**: New interactive panel in the demo application to customize and export CSS themes in real-time.
14
+ - **Improved Slash Menu**: Refactored slash menu with better UI, keyboard navigation, and easier command filtering.
15
+
16
+ ### Breaking Changes
17
+ - **Slash Commands API**: The `slashCommands` input now takes a `SlashCommandsConfig` object (a set of boolean flags) to toggle default commands, instead of a list of command items.
18
+ - **Custom Slash Commands**: To provide your own commands, you must now use the new `customSlashCommands` input.
19
+ - **CSS Variables**: The editor now relies heavily on CSS variables. If you had deep CSS overrides, you might need to update them to use the new `--ate-*` tokens.
20
+
21
+ ### Fixed
22
+ - **Text Color Picker**: Improved initial color detection using computed styles and refined UI behavior to accurately reflect text color even when using theme defaults.
23
+
24
+ ### Changed
25
+ - Renamed several internal components and services for better consistency.
26
+
27
+ ## [0.4.0] - 2026-01-07
28
+
29
+ ### Added
30
+ - Text color picker extension (PR #6 by @nicolashimmelmann)
31
+ - Integrated color picker into the main toolbar and bubble menu
32
+ - New `tiptapExtensions` and `tiptapOptions` inputs for deeper editor customization (PR #6 by @nicolashimmelmann)
33
+
34
+
35
+ ## [0.3.7] - 2025-12-19
36
+
37
+ ### Added
38
+ - `fillContainer` input to make the editor fill the full height of its parent container
39
+
40
+ ## [0.3.6] - 2025-12-19
41
+
42
+ ### Added
43
+ - Custom image upload handler (`imageUploadHandler` input)
44
+ - Support for both `Promise` and `Observable` return types in upload handler
45
+
46
+ ## [0.3.5] - 2025-12-19
47
+
48
+ ### Added
49
+ - `autofocus` input with multiple options (`false`, `'start'`, `'end'`, `'all'`, or position number)
50
+ - Autofocus property support (PR #5 by @elirov)
51
+
52
+ ## [0.3.4] - 2025-12-19
53
+
54
+ ### Fixed
55
+ - Removed console.log statements
56
+
57
+ ## [0.3.3] - 2025-09-05
58
+
59
+ ### Fixed
60
+ - Slash commands functionality improvements
61
+
62
+ ## [0.3.2] - 2025-09-05
63
+
64
+ ### Fixed
65
+ - Table functionality in slash commands
66
+
67
+ ## [0.3.1] - 2025-09-03
68
+
69
+ ### Added
70
+ - Table extension with bubble menu for cell editing
71
+
72
+ ## [0.3.0] - 2025-09-01
73
+
74
+ ### Added
75
+ - Table extension (insert, delete rows/columns, merge cells)
76
+ - Cell bubble menu for table editing
77
+
78
+ ## [0.2.7] - 2025-08-22
79
+
80
+ ### Fixed
81
+ - FormControls now fully Angular 18+ compliant
82
+
83
+ ## [0.2.6] - 2025-08-21
84
+
85
+ ### Fixed
86
+ - FormControl update when editor is not ready yet
87
+
88
+ ## [0.2.5] - 2025-08-21
89
+
90
+ ### Changed
91
+ - Updated README with StackBlitz demo link
92
+
93
+ ## [0.2.4] - 2025-08-21
94
+
95
+ ### Fixed
96
+ - FormControls improvements
97
+
98
+ ## [0.2.3] - 2025-08-20
99
+
100
+ ### Fixed
101
+ - Text alignment controls
102
+ - Image positioning
103
+ - Placeholder display
104
+
105
+ ## [0.2.2] - 2025-08-20
106
+
107
+ ### Fixed
108
+ - Material Symbols font loading
109
+
110
+ ## [0.2.1] - 2025-08-20
111
+
112
+ ### Fixed
113
+ - Peer dependencies versions
114
+ - Library package name
115
+
116
+ ## [0.2.0] - 2025-08-20
117
+
118
+ ### Fixed
119
+ - Angular version compatibility
120
+ - GitHub Pages deployment path
121
+
122
+ ## [0.1.0] - 2025-08-20
123
+
124
+ ### Added
125
+ - Initial release
126
+ - Rich text editing with Tiptap
127
+ - Toolbar with formatting options (bold, italic, underline, strike, code)
128
+ - Heading support (H1, H2, H3)
129
+ - Lists (bullet, ordered)
130
+ - Blockquote and horizontal rule
131
+ - Image upload with drag & drop and progress indicator
132
+ - Resizable images
133
+ - Character and word count
134
+ - Bubble menu for text formatting
135
+ - Image bubble menu with resize controls
136
+ - Slash commands with keyword filtering
137
+ - Highlight extension
138
+ - Customizable toolbar and bubble menu configuration
139
+ - Internationalization support (English, French)
140
+ - Angular 18+ standalone components
141
+ - Reactive Forms support (ControlValueAccessor)
package/README.md CHANGED
@@ -7,7 +7,7 @@ A modern, customizable rich-text editor for Angular applications, built with Tip
7
7
  ## 🚀 Features
8
8
 
9
9
  - **Modern Angular**: Built with Angular 18+ with Signals and modern patterns
10
- - **Rich Text Editing**: Powered by Tiptap v3.3.0 with extensive formatting options
10
+ - **Rich Text Editing**: Powered by Tiptap v2 with extensive formatting options
11
11
  - **Table Support**: Full table management with bubble menus and cell selection
12
12
  - **Slash Commands**: Intuitive slash commands for quick content insertion
13
13
  - **Internationalization**: Full i18n support (English & French) with auto-detection
@@ -112,8 +112,11 @@ export class AdvancedComponent {
112
112
  table: true, // Enable table bubble menu
113
113
  };
114
114
 
115
- slashCommandsConfig = {
116
- commands: [], // Will be populated by the library
115
+ // No config needed if you want all commands enabled
116
+ slashCommands = {
117
+ image: true,
118
+ table: true,
119
+ heading1: true
117
120
  };
118
121
 
119
122
  onContentChange(newContent: string) {
@@ -122,6 +125,36 @@ export class AdvancedComponent {
122
125
  }
123
126
  ```
124
127
 
128
+ You can also pass additional TipTap extensions (including custom marks)
129
+ via the `tiptapExtensions` input.
130
+
131
+ ```typescript
132
+ import { Component } from "@angular/core";
133
+ import { AngularTiptapEditorComponent } from "@flogeez/angular-tiptap-editor";
134
+
135
+ @Component({
136
+ selector: "app-custom-extensions",
137
+ standalone: true,
138
+ imports: [AngularTiptapEditorComponent],
139
+ template: `
140
+ <angular-tiptap-editor
141
+ [content]="content"
142
+ [tiptapExtensions]="extensions"
143
+ (contentChange)="content = $event"
144
+ />
145
+ `,
146
+ })
147
+ export class CustomExtensionsComponent {
148
+ content = "<p>Custom extensions example</p>";
149
+
150
+ extensions = [
151
+ // Add your custom TipTap extensions here
152
+ // Example: Custom extension configuration
153
+ // MyCustomExtension.configure({ /* options */ })
154
+ ];
155
+ }
156
+ ```
157
+
125
158
  ### 3. With Form Integration
126
159
 
127
160
  ```typescript
@@ -336,25 +369,27 @@ Open [http://localhost:4200](http://localhost:4200) to view the demo.
336
369
 
337
370
  #### Inputs
338
371
 
339
- | Input | Type | Default | Description |
340
- | -------------------- | --------------------- | ------------------- | ----------------------------- |
341
- | `content` | `string` | `""` | Initial HTML content |
342
- | `placeholder` | `string` | `"Start typing..."` | Placeholder text |
343
- | `locale` | `'en' \| 'fr'` | Auto-detect | Editor language |
344
- | `editable` | `boolean` | `true` | Whether editor is editable |
345
- | `height` | `number` | `undefined` | Fixed height in pixels |
346
- | `maxHeight` | `number` | `undefined` | Maximum height in pixels |
347
- | `minHeight` | `number` | `200` | Minimum height in pixels |
348
- | `fillContainer` | `boolean` | `false` | Fill parent container height |
349
- | `autofocus` | `boolean \| 'start' \| 'end' \| 'all'` | `false` | Auto-focus behavior |
350
- | `showToolbar` | `boolean` | `true` | Show toolbar |
351
- | `showBubbleMenu` | `boolean` | `true` | Show bubble menu |
352
- | `showCharacterCount` | `boolean` | `true` | Show character counter |
353
- | `showWordCount` | `boolean` | `true` | Show word counter |
354
- | `toolbar` | `ToolbarConfig` | All enabled | Toolbar configuration |
355
- | `bubbleMenu` | `BubbleMenuConfig` | All enabled | Bubble menu configuration |
356
- | `slashCommands` | `SlashCommandsConfig` | All enabled | Slash commands configuration |
357
- | `imageUploadHandler` | `ImageUploadHandler` | `undefined` | Custom image upload function |
372
+ | Input | Type | Default | Description |
373
+ | -------------------- | -------------------------------------- | ------------------- | -------------------------------- |
374
+ | `content` | `string` | `""` | Initial HTML content |
375
+ | `placeholder` | `string` | `"Start typing..."` | Placeholder text |
376
+ | `locale` | `'en' \| 'fr'` | Auto-detect | Editor language |
377
+ | `editable` | `boolean` | `true` | Whether editor is editable |
378
+ | `height` | `number` | `undefined` | Fixed height in pixels |
379
+ | `maxHeight` | `number` | `undefined` | Maximum height in pixels |
380
+ | `minHeight` | `number` | `200` | Minimum height in pixels |
381
+ | `fillContainer` | `boolean` | `false` | Fill parent container height |
382
+ | `autofocus` | `boolean \| 'start' \| 'end' \| 'all'` | `false` | Auto-focus behavior |
383
+ | `showToolbar` | `boolean` | `true` | Show toolbar |
384
+ | `showBubbleMenu` | `boolean` | `true` | Show bubble menu |
385
+ | `showCharacterCount` | `boolean` | `true` | Show character counter |
386
+ | `showWordCount` | `boolean` | `true` | Show word counter |
387
+ | `toolbar` | `ToolbarConfig` | All enabled | Toolbar configuration |
388
+ | `bubbleMenu` | `BubbleMenuConfig` | All enabled | Bubble menu configuration |
389
+ | `slashCommands` | `SlashCommandsConfig` | All enabled | Slash commands configuration |
390
+ | `imageUploadHandler` | `ImageUploadHandler` | `undefined` | Custom image upload function |
391
+ | `tiptapExtensions` | `(Extension \| Node \| Mark)[]` | `[]` | Additional Tiptap extensions |
392
+ | `tiptapOptions` | `Partial<EditorOptions>` | `{}` | Additional Tiptap editor options |
358
393
 
359
394
 
360
395
 
@@ -395,13 +430,16 @@ const bubbleMenuWithTable = {
395
430
  table: true, // Enable table bubble menu
396
431
  };
397
432
 
398
- // Slash commands configuration
433
+ // Slash commands configuration (simple toggle)
434
+ // By default, all commands are enabled and localized.
399
435
  const slashCommands = {
400
- commands: [], // Will be populated by filterSlashCommands()
436
+ heading1: true,
437
+ heading2: true,
438
+ image: false, // Disable image command
401
439
  };
402
440
 
403
- // Available slash command keys
404
- console.log(SLASH_COMMAND_KEYS); // ["heading1", "heading2", "heading3", "bulletList", "orderedList", "blockquote", "code", "image", "horizontalRule", "table"]
441
+ // Available keys: "heading1", "heading2", "heading3", "bulletList",
442
+ // "orderedList", "blockquote", "code", "image", "horizontalRule", "table"
405
443
  ```
406
444
 
407
445
  ## 🌍 Internationalization
@@ -432,22 +470,106 @@ The editor supports English and French with automatic browser language detection
432
470
 
433
471
  ### Custom Slash Commands
434
472
 
473
+ For advanced usage, you can provide entirely custom command items (titles, icons, logic):
474
+
435
475
  ```typescript
436
- import {
437
- filterSlashCommands,
438
- SLASH_COMMAND_KEYS,
476
+ import {
477
+ CustomSlashCommands,
478
+ SlashCommandItem
439
479
  } from "@flogeez/angular-tiptap-editor";
440
480
 
441
- // Filter available slash commands
442
- const activeCommands = new Set(["heading1", "heading2", "bulletList", "table"]);
443
- const commands = filterSlashCommands(activeCommands);
481
+ // Define your custom items
482
+ const myCommands: SlashCommandItem[] = [
483
+ {
484
+ title: 'My Action',
485
+ description: 'Do something cool',
486
+ icon: 'star',
487
+ keywords: ['custom', 'cool'],
488
+ command: (editor) => { /* logic */ }
489
+ }
490
+ ];
444
491
 
445
- // Use in component
446
- slashCommandsConfig = {
447
- commands: commands,
492
+ // Use in template
493
+ customSlashCommands = {
494
+ commands: myCommands,
448
495
  };
449
496
  ```
450
497
 
498
+ And in template:
499
+ ```html
500
+ <angular-tiptap-editor [customSlashCommands]="customSlashCommands" />
501
+ ```
502
+
503
+ ### 🎨 CSS Custom Properties
504
+
505
+ Customize the editor appearance using CSS variables with the `--ate-` prefix:
506
+
507
+ ```css
508
+ /* In your global styles or component styles */
509
+ angular-tiptap-editor {
510
+ --ate-primary: #2563eb;
511
+ --ate-primary-contrast: #ffffff;
512
+ --ate-primary-light: color-mix(in srgb, var(--ate-primary), transparent 90%);
513
+ --ate-primary-lighter: color-mix(in srgb, var(--ate-primary), transparent 95%);
514
+ --ate-primary-light-alpha: color-mix(in srgb, var(--ate-primary), transparent 85%);
515
+
516
+ --ate-surface: #ffffff;
517
+ --ate-surface-secondary: #f8f9fa;
518
+ --ate-surface-tertiary: #f1f5f9;
519
+
520
+ --ate-text: #2d3748;
521
+ --ate-text-secondary: #64748b;
522
+ --ate-text-muted: #a0aec0;
523
+
524
+ --ate-border: #e2e8f0;
525
+
526
+ /* And More... */
527
+ }
528
+ ```
529
+
530
+ #### Dark Mode Support
531
+
532
+ The editor supports dark mode in two ways:
533
+
534
+ **1. With CSS Class**
535
+
536
+ ```html
537
+ <angular-tiptap-editor [class.dark]="isDarkMode" />
538
+ ```
539
+
540
+ **2. With Data Attribute**
541
+
542
+ ```html
543
+ <angular-tiptap-editor [attr.data-theme]="isDarkMode ? 'dark' : null" />
544
+ ```
545
+
546
+ #### Example: Custom Dark Theme
547
+
548
+ ```css
549
+ angular-tiptap-editor.dark {
550
+ --ate-background: #1a1a2e;
551
+ --ate-border-color: #3d3d5c;
552
+ --ate-focus-color: #6366f1;
553
+ --ate-text-color: #e2e8f0;
554
+ --ate-placeholder-color: #64748b;
555
+ --ate-counter-background: #2d2d44;
556
+ --ate-counter-color: #94a3b8;
557
+ --ate-blockquote-background: #2d2d44;
558
+ --ate-code-background: #2d2d44;
559
+ }
560
+ ```
561
+
562
+ #### Example: Custom Brand Colors
563
+
564
+ ```css
565
+ angular-tiptap-editor {
566
+ --ate-focus-color: #8b5cf6;
567
+ --ate-image-selected-color: #8b5cf6;
568
+ --ate-border-radius: 12px;
569
+ }
570
+ ```
571
+
572
+
451
573
  ## 🏗️ Architecture
452
574
 
453
575
  ### Service-Based Design
@@ -504,6 +626,7 @@ This runs the library in watch mode and starts the demo application.
504
626
  - `npm run watch:lib` - Watch library changes
505
627
  - `npm run dev` - Development mode (watch + serve)
506
628
 
629
+
507
630
  ## 📝 License
508
631
 
509
632
  MIT License - see [LICENSE](LICENSE) file for details.
@@ -514,10 +637,10 @@ Contributions are welcome! Please feel free to submit a Pull Request.
514
637
 
515
638
  ## 🔗 Links
516
639
 
517
- - 🎮 [Live Demo](https://flogeez.github.io/angular-tiptap-editor/)
518
640
  - 📖 [Tiptap Documentation](https://tiptap.dev/)
519
641
  - 🅰️ [Angular Documentation](https://angular.dev/)
520
642
  - 📦 [NPM Package](https://www.npmjs.com/package/@flogeez/angular-tiptap-editor)
643
+ - 📖 [Live Demo](https://flogeez.github.io/angular-tiptap-editor/)
521
644
  - 🐛 [Report Issues](https://github.com/FloGeez/angular-tiptap-editor/issues)
522
645
  - 💡 [Feature Requests](https://github.com/FloGeez/angular-tiptap-editor/issues)
523
646
 
@@ -534,7 +657,6 @@ Contributions are welcome! Please feel free to submit a Pull Request.
534
657
  - ✅ **Office Paste**: Clean pasting from Microsoft Office applications
535
658
  - ✅ **Enhanced i18n**: Improved internationalization with better architecture
536
659
 
537
-
538
660
  ---
539
661
 
540
662
  Made with ❤️ by [FloGeez](https://github.com/FloGeez)