fix(edit-content): allow saving code files with warnings in file editor (#36543) - #36547
Conversation
|
Claude finished @adrianjm-dotCMS's task in 1m 48s —— View job Code Review
Solid, well-documented fix. The core design decision — reading real Monaco markers directly at submit time via New Issues
Notes (non-blocking)
Test coverage for the severity gate is thorough (hint/warning save, error blocks, mixed blocks, recovery, name gate). Adding one Nothing here blocks merge. |
…or (#36543) The file/code editor blocked Save whenever the Monaco model had any marker. ngx-monaco-editor registers as an NG_VALIDATORS and reports ANY marker (including informational TS diagnostics like "declared but never read") as a `monaco` form error, silently invalidating the form — the template only ever surfaced errors for the `name` field, so Save appeared to do nothing. Now only genuine `Error`-severity markers block saving; hints/warnings pass through. When a real syntax error is present the editor gets a red outline (PrimeNG invalid token) and a message below it, replacing the mime-type hint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4034437 to
36ee849
Compare
|
Tick the box to add this pull request to the merge queue (same as
|
Proposed Changes
Fixes #36543 — the file/code editor (binary & file fields, both the new Angular editor and the legacy Dojo web component) silently refused to save code that contained editor warnings.
Root cause
@materia-ui/ngx-monaco-editorregisters itself as anNG_VALIDATORSfor thecontentcontrol and reports any marker on the Monaco model as a singlemonacoform error — with no severity attached. Since the JS/TS language service produces informational diagnostics (e.g.'x' is declared but its value is never read.for unused vars/params, very common in jQuery-style theme scripts), the form becameINVALIDandonSubmit()returned early. The template only surfaced errors for thenamefield, so Save appeared to do nothing with no feedback.Screen.Recording.2026-07-13.at.2.12.00.PM.mov
Fix
Error-severity marker (real syntax errors). Hints/warnings (unused vars, unreachable code, etc.) no longer block Save.--p-form-field-invalid-border-colorinvalid token, with a Larared.400hex fallback for the legacy Dojo bundle) and a message below it (dot.file.field.error.syntax), which replaces the mime-type hint.namevalidation and any future non-monacocontent validators still block as before.Files
dot-form-file-editor.component.ts— severity-aware#hasBlockingErrors()+$hasSyntaxErrorsignal driven by the control'sstatusChanges.dot-form-file-editor.component.html— red-outline class binding + error message / mime-type toggle.dot-form-file-editor.component.scss—--errormodifier.Language.properties— newdot.file.field.error.syntaxkey.dot-form-file-editor.component.spec.ts— 7 unit tests covering the severity gate (hint/warning save, error blocks, mixed blocks, recovery, name gate).Checklist
Notes / follow-up
The same over-eager validator pattern also exists in
DotEditContentMonacoEditorControlComponent(JSON / text-area / WYSIWYG-code fields), where it can block saving/publishing the whole contentlet. Out of scope for this PR — worth a separate follow-up.🤖 Generated with Claude Code
This PR fixes: #36543