Open basavarj opened 2 years ago
I use a custom FroalaComponent for this. It extends MatFormField and ControlValueAccessor and many more.
private _editor: FroalaEditor | null = null;
... initialization stuffs
setValue(value: string | null) {
this._editor.html.set(value || '');
this._editor.undo.reset();
this._editor.undo.saveStep();
}
I would recommend checking if the editor already exists and handle / save the value for later if it doesn't. Also it might be handy to check if the value is the same, as the current content - because then you would not want to reset the undo.
'contentChanged': function () { this.reportContent = this.html.get();
// this.eventEmitterService.froalaContent.next(this.reportContent);
}
I tried to pass updated content in contentChanged event but angular code doesn't work in any of froala events. Please help me