jodit / jodit/jodit-angular

Support Angular 15? Issue with setDisabledState

Open
#112 8 comments 0 reactions 1 assignee View on GitHub

@MrElectroNick is already working on this.

Since Jan 24, 2023.

bug
Dominant language
TypeScript
Stars
48
Forks
35
PR merge metrics
No merged PRs in 30d

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!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.