Skip to content

Fixed disabled property with ngModel#95

Merged
carlosmintfan merged 2 commits intomainfrom
opencode/issue65-20260104175412
Jan 15, 2026
Merged

Fixed disabled property with ngModel#95
carlosmintfan merged 2 commits intomainfrom
opencode/issue65-20260104175412

Conversation

@opencode-agent
Copy link
Copy Markdown
Contributor

@opencode-agent opencode-agent Bot commented Jan 4, 2026

The fix has been successfully applied and tested. Here's a summary:

Changes Made

File: hugerte-angular-component/src/main/ts/editor/editor.component.ts

  • Removed the && this._editor.initialized check from the disabled setter (line 77)
  • Now the mode is set as soon as the editor instance is available, even before it's fully initialized

File: hugerte-angular-component/src/test/ts/browser/DisabledPropertyTest.ts (new)

  • Added comprehensive tests for the disabled property with ngModel
  • Tests verify the editor initializes in disabled state when disabled=true
  • Tests verify toggling disabled state works correctly
  • Tests verify disabled property works with template-driven forms (ngModel)

Why This Fixes the Issue

In template-driven forms with ngModel, the setDisabledState method is called during form initialization. The previous code only set the editor mode if this._editor && this._editor.initialized was true, which meant:

  1. If setDisabledState was called before the editor was fully initialized → mode not set
  2. If setDisabledState was called during the setup callback (before initialized flag is set) → mode not set

By removing the initialized check, the mode is now set immediately when the editor instance is available (during the setup callback), which happens before the editor is fully initialized. This ensures the disabled state is applied correctly regardless of when setDisabledState is called.

The fix also maintains the readonly: this.disabled config in the initialization options as a fallback for cases where the disabled property is set very early.

Closes #65

New%20session%20-%202026-01-04T17%3A54%3A11.272Z
opencode session  |  github run

Comment thread .github/workflows/ci.yml Fixed
opencode-agent Bot and others added 2 commits January 15, 2026 12:32
Co-authored-by: carlosmintfan <carlosmintfan@users.noreply.github.com>
@carlosmintfan carlosmintfan force-pushed the opencode/issue65-20260104175412 branch from 9c768c6 to 1cd171e Compare January 15, 2026 15:32
@carlosmintfan carlosmintfan merged commit 6311cee into main Jan 15, 2026
5 of 6 checks passed
@carlosmintfan carlosmintfan deleted the opencode/issue65-20260104175412 branch January 19, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disabled property ignored on initialization in template-driven forms

2 participants