Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/editor/editor.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export class FroalaEditorDirective implements ControlValueAccessor {
// Form model content changed.
writeValue(content: any): void {
this.updateEditor(content);
if(content){
this.setup();
}
}

registerOnChange(fn: (_: any) => void): void { this.onChange = fn; }
Expand Down Expand Up @@ -346,6 +349,15 @@ export class FroalaEditorDirective implements ControlValueAccessor {
// TODO not sure if ngOnInit is executed after @inputs
ngAfterViewInit() {
// check if output froalaInit is present. Maybe observers is private and should not be used?? TODO how to better test that an output directive is present.
this.setup();
}

private initialized = false;
private setup() {
if (this.initialized) {
return;
}
this.initialized = true;
if (!this.froalaInit.observers.length) {
this.createEditor();
} else {
Expand Down