fix: stop pausing spellcheck around edits - #451
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 55 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe editor now guards against WebKit em-dash substitution, removes the spell-check plugin integration and utility, and preserves view attributes. The website demo reorders imports and adds image dimensions. ChangesEditor input behavior
Website demo metadata
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant EditorDOM
participant defineSystemSubstitutionGuard
participant ProseMirrorEditorView
EditorDOM->>defineSystemSubstitutionGuard: beforeinput replacement with em dash
defineSystemSubstitutionGuard->>EditorDOM: preventDefault()
ProseMirrorEditorView->>defineSystemSubstitutionGuard: view update completes
defineSystemSubstitutionGuard->>ProseMirrorEditorView: restore prior selection
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
commit: |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
427b15c to
331a681
Compare
spellcheck attribute at mount and stop pausing it around editsspellcheck around edits
331a681 to
28baf94
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/react/src/components/editor-extensions.tsx`:
- Around line 103-111: Update the effect containing defineViewAttributes so the
initial spellCheck value is captured and registered by a separate mount-only
extension before the dynamic editorClassName extension. Keep the class attribute
extension dependent on editorClassName, but ensure its cleanup cannot remove or
reapply the spellcheck attribute during an active editor session.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a98b2429-e6d7-43ee-8e64-05bac4519ed9
📒 Files selected for processing (7)
packages/core/src/extensions/extension.tspackages/core/src/extensions/spell-check.tspackages/core/src/extensions/system-substitution-guard.tspackages/core/src/index.tspackages/core/src/utils/is-mark-step.tspackages/react/src/components/editor-extensions.tsxwebsite/src/app.tsx
💤 Files with no reviewable changes (3)
- packages/core/src/index.ts
- packages/core/src/extensions/spell-check.ts
- packages/core/src/utils/is-mark-step.ts
| const attrs: { [key: string]: string } = { | ||
| spellcheck: spellCheck ? 'true' : 'false', | ||
| } | ||
| if (editorClassName) { | ||
| attrs['class'] = editorClassName | ||
| } | ||
| const extension = defineViewAttributes(attrs) | ||
| return editor.use(extension) | ||
| }, [editor, editorClassName]) | ||
| }, [editor, editorClassName, spellCheck]) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map the changed component before inspecting relevant lifecycle usage.
ast-grep outline packages/react/src/components/editor-extensions.tsx --items all
# Inspect editor extension cleanup usage and spellcheck-related tests.
rg -n -C 6 --glob '*.ts' --glob '*.tsx' '\.use\(|spellCheck|editorClassName' packages
rg -n -C 6 --glob '*test*.ts' --glob '*test*.tsx' --glob '*spec*.ts' --glob '*spec*.tsx' \
'EditorExtensions|spellCheck|editorClassName' packagesRepository: prosekit/meowdown
Length of output: 50373
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the relevant extension lifecycle and the static spellcheck prop handling.
sed -n '1,140p' packages/react/src/components/editor-extensions.tsx
sed -n '350,390p' packages/react/src/components/prosekit-editor.tsx
sed -n '560,605p' packages/react/src/components/prosekit-editor.tsx
# Locate and inspect the core view-attributes implementation.
fd -a 'view-attributes' .
rg -n 'defineViewAttributes|viewAttributes|editorClassName' packages/core/src packages/react/src
# Inspect the exact core test around cleanup.
sed -n '1,60p' packages/core/src/extensions/view-attributes.test.tsRepository: prosekit/meowdown
Length of output: 11149
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the view-attributes implementation and React integration.
sed -n '1,90p' packages/core/src/extensions/view-attributes.ts
rg -n -C 3 'function useExtension|export function useExtension|defineViewAttributes|spellcheck' packages/react/src packages/core/src -g '*.ts' -g '*.tsx'
# Read the static spellCheck handling from ProseKitEditor.
sed -n '540,560p' packages/react/src/components/prosekit-editor.tsx
sed -n '354,398p' packages/react/src/components/prosekit-editor.tsxRepository: prosekit/meowdown
Length of output: 10669
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find useExtension in installed dependencies without mutating files.
git ls-files packages/react/src | xargs rg -n 'useExtension' || true
find node_modules/@prosekit/react -maxdepth 10 -type f \( -name '*.js' -o -name '*.mjs' \) 2>/dev/null | xargs rg -n 'function useExtension|export .*useExtension' || true
fd -a -e js -e mjs -e cjs 'prosekit' node_modules 2>/dev/null | head -50 || true
# Inspect ProseKitEditor static spellCheck handling around EditorExtensions prop.
sed -n '354,398p' packages/react/src/components/prosekit-editor.tsxRepository: prosekit/meowdown
Length of output: 4992
Keep the spellcheck attribute extension mount-only.
Changing editorClassName reruns this effect, and the returned cleanup removes the view-attributes extension that also owns spellcheck. That removes and reapplies spellcheck during an active editor session. Store the initial spellCheck value and register a separate mount-only spellcheck extension from it before the dynamic editorClassName extension.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/react/src/components/editor-extensions.tsx` around lines 103 - 111,
Update the effect containing defineViewAttributes so the initial spellCheck
value is captured and registered by a separate mount-only extension before the
dynamic editorClassName extension. Keep the class attribute extension dependent
on editorClassName, but ensure its cleanup cannot remove or reapply the
spellcheck attribute during an active editor session.
The pause from #186 also suppressed WebKit's as-you-type spell marking (WebKit checks a word the moment its boundary is typed and never re-checks it later), so set the attribute statically at mount. In its place, a new always-on guard cancels the
beforeinputinsertReplacementTextevents whose replacement contains an em dash, so the macOS smart-dashes rewrite can no longer corrupt Markdown such as the-->closing an image sizing comment.Summary by CodeRabbit
Bug Fixes
Refactor
Performance