@flogeez/angular-tiptap-editor 0.2.4 → 0.2.5
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/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A modern, customizable rich-text editor for Angular applications, built with Tip
|
|
|
6
6
|
|
|
7
7
|
## 🚀 Features
|
|
8
8
|
|
|
9
|
-
- **Modern Angular**: Built with Angular
|
|
9
|
+
- **Modern Angular**: Built with Angular 18+
|
|
10
10
|
- **Rich Text Editing**: Powered by Tiptap with extensive formatting options
|
|
11
11
|
- **Internationalization**: Full i18n support (English & French) with auto-detection
|
|
12
12
|
- **Customizable**: Highly configurable toolbar, bubble menus, and slash commands
|
|
@@ -3650,6 +3650,7 @@ class AngularTiptapEditorComponent {
|
|
|
3650
3650
|
// ControlValueAccessor implementation
|
|
3651
3651
|
this.onChange = (value) => { };
|
|
3652
3652
|
this.onTouched = () => { };
|
|
3653
|
+
this.pendingFormValue = null;
|
|
3653
3654
|
this.i18nService = inject(TiptapI18nService);
|
|
3654
3655
|
// Effet pour gérer le changement de langue
|
|
3655
3656
|
effect(() => {
|
|
@@ -3694,10 +3695,8 @@ class AngularTiptapEditorComponent {
|
|
|
3694
3695
|
// L'initialisation se fait maintenant dans ngAfterViewInit
|
|
3695
3696
|
}
|
|
3696
3697
|
ngAfterViewInit() {
|
|
3697
|
-
//
|
|
3698
|
-
|
|
3699
|
-
this.initEditor();
|
|
3700
|
-
}, 0);
|
|
3698
|
+
// La vue est déjà complètement initialisée dans ngAfterViewInit
|
|
3699
|
+
this.initEditor();
|
|
3701
3700
|
}
|
|
3702
3701
|
ngOnDestroy() {
|
|
3703
3702
|
const currentEditor = this.editor();
|
|
@@ -3775,7 +3774,6 @@ class AngularTiptapEditorComponent {
|
|
|
3775
3774
|
// Note: La mise à jour des états des boutons est maintenant gérée par TiptapBubbleMenuComponent
|
|
3776
3775
|
},
|
|
3777
3776
|
onCreate: ({ editor }) => {
|
|
3778
|
-
this.editor.set(editor);
|
|
3779
3777
|
this.editorCreated.emit(editor);
|
|
3780
3778
|
this.updateCharacterCount(editor);
|
|
3781
3779
|
// Marquer l'éditeur comme complètement initialisé après un court délai
|
|
@@ -3792,6 +3790,13 @@ class AngularTiptapEditorComponent {
|
|
|
3792
3790
|
this.editorBlur.emit({ editor, event });
|
|
3793
3791
|
},
|
|
3794
3792
|
});
|
|
3793
|
+
// Stocker la référence de l'éditeur immédiatement
|
|
3794
|
+
this.editor.set(newEditor);
|
|
3795
|
+
// Appliquer la valeur du FormControl en attente si elle existe
|
|
3796
|
+
if (this.pendingFormValue !== null) {
|
|
3797
|
+
this.setContent(this.pendingFormValue, false);
|
|
3798
|
+
this.pendingFormValue = null;
|
|
3799
|
+
}
|
|
3795
3800
|
}
|
|
3796
3801
|
updateCharacterCount(editor) {
|
|
3797
3802
|
if (this.showCharacterCount() && editor.storage["characterCount"]) {
|
|
@@ -3885,6 +3890,11 @@ class AngularTiptapEditorComponent {
|
|
|
3885
3890
|
const currentEditor = this.editor();
|
|
3886
3891
|
if (currentEditor && value !== currentEditor.getHTML()) {
|
|
3887
3892
|
this.setContent(value || "", false);
|
|
3893
|
+
this.pendingFormValue = null; // Valeur appliquée, plus besoin de la stocker
|
|
3894
|
+
}
|
|
3895
|
+
else {
|
|
3896
|
+
// Éditeur pas encore prêt, stocker la valeur du FormControl pour plus tard
|
|
3897
|
+
this.pendingFormValue = value || "";
|
|
3888
3898
|
}
|
|
3889
3899
|
}
|
|
3890
3900
|
registerOnChange(fn) {
|