toggleMark: append mark unless it is already present throughout the selection #17

Closed
jgravois wants to merge 1 commit from toggle-mark-patch into master
jgravois commented 2023-11-21 08:35:17 +01:00 (Migrated from github.com)

greetings! 👋

we've had a few users report that they expect a mark to be toggled on when only a subset of their selection is already similarly marked.

ie: "something important!" > "something important!"

i checked a few other text editors and the current behavior definitely appears to be an aberration.

if this isn't a change you're interested in landing, no offense taken. if it is something you're willing to entertain, i'm happy polish up this PR by updating the inline documentation and taking a crack at writing a new unit test to verify the expected behavior.

greetings! 👋 we've had a few users report that they expect a mark to be toggled _on_ when only a subset of their selection is already similarly marked. ie: "something **important**!" > "**something important!**" i checked a few other text editors and the current behavior definitely appears to be an aberration. if this isn't a change you're interested in landing, no offense taken. if it _is_ something you're willing to entertain, i'm happy polish up this PR by updating the inline documentation and taking a crack at writing a new unit test to verify the expected behavior.
marijnh commented 2023-11-21 15:36:45 +01:00 (Migrated from github.com)

We cannot change the default behavior at this point. But attached patch adds an option that allows you to opt in to the behavior you describe. Does that look like it'd solve your problem?

We cannot change the default behavior at this point. But attached patch adds an option that allows you to opt in to the behavior you describe. Does that look like it'd solve your problem?
jgravois commented 2023-11-21 18:45:31 +01:00 (Migrated from github.com)

i appreciate the quick response @marijnh. your patch typically results in the desired behavior.

one quirk i noticed is that the new flag makes it impossible to remove a mark from text selections with trailing whitespace.

ie: "important! " > "important! "

i appreciate the quick response @marijnh. your patch typically results in the desired behavior. one quirk i noticed is that the new flag makes it impossible to remove a mark from text selections with trailing whitespace. ie: **"important! "** > **"important! "**
marijnh commented 2023-11-22 12:07:18 +01:00 (Migrated from github.com)

Thanks for spotting that. Attached patch should help.

Thanks for spotting that. Attached patch should help.

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!17
No description provided.