-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Hello,
Thanks for the Angular wrapper!
We've updated our app to Angular 15 but facing an error with jodit-angular. The package worked fine with Angular 14 so it's a recent update.
The error is Cannot read properties of undefined (reading 'setReadOnly'). This is thrown when setDisabledState() is called.
I believe the breaking change in Angular is the following: "In Angular 15, the setDisabledState is called when a ControlValueAccessor is attached. To avert using the same behavior, use FormsModule.withConfig or ReactiveFormsModule.withConfig."
A quick fix is to add a guard to setDisabledState() to check editor is defined.
setDisabledState(isDisabled: boolean): void {
if (!this.editor) return; // guard to check if editor is defined.
this.editor.setReadOnly(isDisabled);
}
I would submit a PR but not sure what else needs changing so just calling out this fix and hoping for a new version soon. Thanks!