Skip to content

Remove zero width space when getting text range for comment highlights#596

Merged
ajwild merged 4 commits intomasterfrom
zero-width-space-text-ranges
Mar 23, 2026
Merged

Remove zero width space when getting text range for comment highlights#596
ajwild merged 4 commits intomasterfrom
zero-width-space-text-ranges

Conversation

@ajwild
Copy link
Contributor

@ajwild ajwild commented Apr 3, 2025

Relations:

Motivation

When creating comments in Livingdocs it uses the selected text to create a highlight. If the text selection contains a zero width non-breaking space, which is removed when the component is blurred, then the highlight never computes the correct start and end offset for the range because the text string no longer matches.

Changelog

  • 🍬 Validate (optional) text when highlighting range
  • 🐞 Remove zero width space to make selection more accurate, because it will be removed on component blur via extractContent
  • 🐞 Prevent DOM mutation when calling getInnerHtmlOfFragment

@ajwild ajwild force-pushed the zero-width-space-text-ranges branch 2 times, most recently from b0097a8 to a6f34d6 Compare April 4, 2025 18:37
@ajwild ajwild marked this pull request as draft April 5, 2025 09:51
@ajwild ajwild force-pushed the zero-width-space-text-ranges branch from a6f34d6 to e287f0d Compare May 26, 2025 16:47
@ajwild ajwild marked this pull request as ready for review May 26, 2025 16:52
@ajwild ajwild force-pushed the zero-width-space-text-ranges branch from e287f0d to 73e32e4 Compare June 4, 2025 10:51
@ajwild ajwild force-pushed the zero-width-space-text-ranges branch from 73e32e4 to 5a5d397 Compare August 12, 2025 13:40
@ajwild ajwild force-pushed the zero-width-space-text-ranges branch from 142ef7f to cce8a09 Compare March 2, 2026 07:00
@ajwild ajwild force-pushed the zero-width-space-text-ranges branch from cce8a09 to 4c84521 Compare March 4, 2026 12:46
@marcbachmann
Copy link
Member

marcbachmann commented Mar 20, 2026

💥 /backport release-2026-03

The backport to release-2026-03 failed.
Please do this backport manually.

git fetch origin release-2026-03
git checkout -b backport/596/release-2026-03 release-2026-03
git cherry-pick d4e3181bd98792b0e8e213d9d30e5fbc07f0f7f0..4c845214a8ff157270e50d5a12d2095f3a579ecc
git push -u origin backport/596/release-2026-03
Error: Command failed: /usr/bin/git fetch origin release-2026-03 4c845214a8ff157270e50d5a12d2095f3a579ecc master
fatal: couldn't find remote ref release-2026-03

    at genericNodeError (node:internal/errors:985:15)
    at wrappedFn (node:internal/errors:539:14)
    at ChildProcess.exithandler (node:child_process:417:12)
    at ChildProcess.emit (node:events:508:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1101:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:508:28)
    at Socket.emit (node:domain:489:12)
    at Pipe.<anonymous> (node:net:346:12)

@ajwild ajwild merged commit 966355c into master Mar 23, 2026
4 checks passed
@ajwild ajwild deleted the zero-width-space-text-ranges branch March 23, 2026 04:47
@livingdocs-automation
Copy link
Collaborator

🎉 This PR is included in version 5.1.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants