add failing test to highlight removeWhenPresent misbehavior #18

Closed
jgravois wants to merge 1 commit from patch-2 into master
jgravois commented 2023-11-27 03:41:06 +01:00 (Migrated from github.com)

hello again! 👋

in testing your patches from #17 i spotted another edge case that makes it impossible to successfully toggle marks.

  1. add a mark to a single word within a sentence.
  2. create a selection that includes the word and subsequent whitespace
  3. attempt to toggle the mark again.

w/ {removeWhenPresent:false} i would expect the initial execution of the command to append the mark to the newly selected whitespace and the second call to remove the mark from the entire selection.

in actuality, the mark cannot be added to the trailing whitespace, and hence cannot be removed from the actual word.

hello again! 👋 in testing your patches from #17 i spotted another edge case that makes it impossible to successfully toggle marks. 1. add a mark to a single word within a sentence. 1. create a selection that includes the word and subsequent whitespace 1. attempt to toggle the mark again. w/ `{removeWhenPresent:false}` i would expect the initial execution of the command to append the mark to the newly selected whitespace and the second call to remove the mark from the entire selection. in actuality, the mark cannot be added to the trailing whitespace, and hence cannot be removed from the actual word.
marijnh commented 2023-11-27 11:13:13 +01:00 (Migrated from github.com)

Thanks for spotting that. This patch should help.

Thanks for spotting that. This patch should help.
jgravois commented 2023-11-27 16:37:30 +01:00 (Migrated from github.com)

This patch should help.

indeed it does. thanks for all the effort you put into maintaining these libraries 🙏

> This patch should help. indeed it does. thanks for all the effort you put into maintaining these libraries 🙏

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
prosemirror/prosemirror-commands!18
No description provided.