[WIKI-343] [WIKI-312] Fix: html characters#7049
Conversation
WalkthroughThe changes update the editor initialization in both Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Pull Request Linked with Plane Work Items
Comment Automatically Generated by Plane |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/editor/src/core/hooks/use-editor.ts(2 hunks)packages/editor/src/core/hooks/use-read-only-editor.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (4)
packages/editor/src/core/hooks/use-editor.ts (2)
116-116: Properly fixed HTML symbol handling 👍The removal of the
preserveWhitespaceoption fromsetContentis correct. This change will fix the issue with special characters like<,>, and&being incorrectly converted to HTML entities.
149-149: Consistent fix applied to imperative handle methodThis change correctly removes the
preserveWhitespaceoption from thesetEditorValuemethod, ensuring consistent behavior across all content setting operations.packages/editor/src/core/hooks/use-read-only-editor.ts (2)
74-74: Properly fixed HTML symbol handling in useEffectThis correctly removes the
preserveWhitespaceoption, fixing the HTML special characters handling issue when syncing external content.
82-82: Consistent fix applied to imperative handle methodThis change correctly removes the
preserveWhitespaceoption from thesetEditorValuemethod, ensuring consistent behavior across all content setting operations.
2291ed7 to
0fba523
Compare
* fix: handle symbols and space * chore: refactor
Description
This PR removes the preserveWhitespace option when setting content in the editor. Previously, this option was causing issues with the HTML parser, where characters like <, >, and & were incorrectly converted to
<,>, and&.Screenshots and Media (if applicable)
Screen.Recording.2025-05-15.at.12.47.59.PM.mov
https://prosemirror.net/docs/ref/#model.ParseOptions.preserveWhitespace
Summary by CodeRabbit