fix: add link on commented text removes the comment highlight (2573)#2592
fix: add link on commented text removes the comment highlight (2573)#2592miadnguyen wants to merge 1 commit intoTypeCellOS:mainfrom
Conversation
|
@miadnguyen is attempting to deploy a commit to the TypeCell Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Summary
This pull request fixes an issue where adding or editing a link on commented text removes the comment highlight and comment association. After this change, a link can be added or edited on commented text while preserving both the link underline and the existing comment behavior.
Rationale
The issue was caused by
LinkToolbarExtension.editLink()(from packages/core/src/extensions/LinkToolbar/LinkToolbar.ts) replacing the selected text withinsertText(...)and then reapplying only thelinkmark. As a result, existing marks on that text, including thecommentmark, were lost. Preserving existing non-link marks makes link editing behave correctly and keeps comment functionality intact.Changes
LinkToolbarExtension.editLink()to preserve existing marks on the selected text before replacing itinsertText(...)linkmark after restoring the preserved marksImpact
This change affects the link editing flow for text that already contains other marks, especially comments. It should improve behavior by preserving comment highlighting and comment accessibility when links are added or edited. The intended behavior for normal link editing remains the same.
Testing
Manual testing performed in the local comment demo:
Screenshots/Video
Below is an image showing commented text retaining the comment, highlight, and link after the fix.

Checklist
Additional Notes
Fixes #2573
Summary by CodeRabbit
Bug Fixes