froala / angular-froala-wysiwyg

Angular 4, 5, 6, 7, 8 and 9 plugin for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
732 stars 200 forks source link

Issue in froalaEditor directive if binded, some times content does not update #446

Open IslamElKassas opened 3 years ago

IslamElKassas commented 3 years ago

When I bind the froalaEditor directive with options object, and navigate to a page, and back to the editor again, then edit content, it some times update the content and some times does not (when get it from form data, or from two way binded variable).

Also the problem happened some times when hide and show the editor again with ngIf

I test it many times with two way binding, and within reactive forms. but the problem some times appears.

If I removed the binding, it will work well.

I also tried div and textarea

I use Fuse Angular Template, Froala 3.2.3

Here are my codes:

<div [froalaEditor]="froalaEditorOptions" formControlName="emailContent"></div>

"styles": [
                "./node_modules/froala-editor/css/froala_editor.pkgd.min.css",
                "./node_modules/froala-editor/css/froala_style.min.css",
                "./node_modules/font-awesome/css/font-awesome.min.css",
                "src/styles.scss"
            ],

all js files imported in a separate module

import 'froala-editor/js/plugins.pkgd.min.js';

import 'froala-editor/js/third_party/font_awesome.min';
import 'froala-editor/js/third_party/image_tui.min';
import 'froala-editor/js/third_party/embedly.min';

import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
@NgModule({
    imports  : [
        FroalaEditorModule.forRoot(),
        FroalaViewModule.forRoot()
    ],
    exports  : [
        FroalaEditorModule,
        FroalaViewModule
    ]
})
export class FroalaModule
{
}
MRH4287 commented 3 years ago

We have the same behaviour in our application. Our backing field has a value set, but the editor is empty.

We use Froala Version 3.2.6-1

<textarea matInput [formControlName]="controlName" [id]="id"
          #input [rows]="lines" (froalaInit)="initialize($event)"
          [froalaEditor]="options" [(froalaModel)]="controlValue"></textarea>
IslamElKassas commented 3 years ago

@MRH4287 Yes in this version 3.2.6-1, I still have this issue.

I solved it temporarily by this code,

  ngAfterViewInit()
  {
      this.froalaEditorOptions = {...FroalaEditorOptions};
  }

Please some one tell us if this is the best way or not

bergermanuel commented 3 years ago

@IslamElKassas We tried your workaround but it didn't solve the problem.

Any updates on this?