GravityView
GravityView copied to clipboard
Disable linting for CSS mode in CodeMirror editor
- Implements https://github.com/GravityKit/GravityView/issues/2411
- Disable linting for CSS mode in CodeMirror editor to support modern CSS syntax in WordPress. This change ensures compatibility with the WordPress CSS editor, which does not handle modern CSS features.
💾 Build file (4ffc0517b).
Summary by CodeRabbit
- Bug Fixes
- Resolved false warnings in the admin CSS editor by disabling linting for CSS, allowing modern CSS syntax without erroneous errors.
- Improves editing experience and compatibility with contemporary CSS features.
- No changes to linting behavior for other languages or editors.
Walkthrough
Disables CodeMirror linting for editors initialized with CSS mode by setting codemirrorConfig.codemirror.lint = false in setupCodeMirror after merging data-codemirror attributes; no other behavior or API changes.
Changes
| Cohort / File(s) | Summary |
|---|---|
CodeMirror CSS lint toggleassets/js/admin-views.js |
In setupCodeMirror, after merging data-codemirror attributes, if attributeValue.mode === 'css', set codemirrorConfig.codemirror.lint = false to disable linting for CSS mode. No other logic or API changes. |
Sequence Diagram(s)
(omitted)
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
- Review
assets/js/admin-views.jsaroundsetupCodeMirrorto confirm the conditional placement and thatcodemirrorConfigis defined when modified. - Verify there are no unintended side effects for editors that rely on lint being enabled by other configuration sources.
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title directly and clearly describes the main change: disabling CodeMirror linting specifically for CSS mode, which matches the core functionality implemented in the changeset. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
issue/2411-custom-code-editor-shows-false-warnings-for-valid-modern-css
Comment @coderabbitai help to get the list of available commands and usage tips.