Skip to content

fix(editor): allow browser spell check in markdown editor#68

Merged
PascalRepond merged 1 commit intomainfrom
rep-dev
Mar 21, 2026
Merged

fix(editor): allow browser spell check in markdown editor#68
PascalRepond merged 1 commit intomainfrom
rep-dev

Conversation

@PascalRepond
Copy link
Copy Markdown
Owner

Also update dependencies.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a61ede2a-3330-4311-ac35-1268f8d1367e

📥 Commits

Reviewing files that changed from the base of the PR and between 21450a0 and 9990a86.

⛔ Files ignored due to path filters (2)
  • src/theme/static_src/package-lock.json is excluded by !**/package-lock.json
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • src/core/forms.py
  • src/tests/core/test_htmx_validation.py
  • src/tests/core/test_mediaform_htmx.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/forms.py

📝 Walkthrough

Walkthrough

Narrowed HTMX-driven per-field validation in MediaForm.__init__ to an explicit set of validated fields (title, external_uri, pub_year, review_date) and changed the review field’s widget to MDEWidget(options={"nativeSpellcheck": True, "inputStyle": "contenteditable"}).

Changes

Cohort / File(s) Summary
Form widget & HTMX wiring
src/core/forms.py
Adjusted MediaForm.Meta.widgets["review"] to pass options={"nativeSpellcheck": True, "inputStyle": "contenteditable"} to MDEWidget. Replaced broad per-field HTMX attribute injection loop with an explicit validated_fields list and only applied hx-* attributes to title, external_uri, pub_year, and review_date.
HTMX validation tests
src/tests/core/test_htmx_validation.py, src/tests/core/test_mediaform_htmx.py
Renamed and broadened test_htmx_validate_field_* to assert blank responses for fields allowed to be blank (cover, contributors, review, score). Updated test_mediaform_htmx to assert HTMX attributes appear only on the explicit validated_fields set and are absent on other fields.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description is too vague and generic; 'Also update dependencies' is minimal and doesn't meaningfully convey what changes are being made. Expand the description to explain the specific changes: enabling native spellcheck in the markdown editor widget and narrowing HTMX validation to specific fields.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: enabling browser spell check in the markdown editor widget configuration.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rep-dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/core/forms.py`:
- Line 59: The MDEWidget for the "review" field currently uses
inputStyle="contenteditable" which can desync content from the underlying
textarea before HTMX validation or form submission; change the field definition
in the form (the "review" entry that instantiates MDEWidget) to remove
inputStyle="contenteditable" so it uses the default textarea (i.e.,
MDEWidget(options={"nativeSpellcheck": True})); if you must keep
contenteditable, instead add "review" to the form's HTMX exclusion list in
__init__ (same place as "cover" and "contributors") and add explicit sync logic
in media_edit.js to copy the contenteditable editor back into the textarea
before any HTMX request or on form submit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0d0190b8-d181-41d2-a9b3-88150f28d667

📥 Commits

Reviewing files that changed from the base of the PR and between 6505211 and 21450a0.

⛔ Files ignored due to path filters (2)
  • src/theme/static_src/package-lock.json is excluded by !**/package-lock.json
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • src/core/forms.py

Keep contenteditable mode for Firefox spellcheck support but exclude
the review field from HTMX validation to avoid content desync.
Refactor validation to disable fields where dynamic validation is not
needed, and using an explicit allowlist instead of a growing denylist.
@PascalRepond PascalRepond merged commit 202a76b into main Mar 21, 2026
3 checks passed
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.

1 participant