Doubleclick Selection of Word and applying Marks in MS Windows

Hi, I have a question regarding double click on a word to select it and then applying a mark (e.g. underline tag).

On Linux (Firefox, Chromium) I get the expected behaviour: A double click selects the word and the mark is applied up to the word boundaries. On Windows (Chrome, Firefox) I get a different behaviour: The double click also selects the first whitespace after the selected word, and the mark is applied to that, too (visible for e.g. underline)

Digging deeper into that issue, this seems to be a standard behaviour on Windows – but probably not what the user expects (at least I have received some complaints :grin:). However, I also looked into how MS Office / Word is handling that: When double-clicking on a word the selection is the same as in other windows apps (word + next whitespace is selected), but applying a “mark” in MS Word only applies it to the word itself, and not the also selected whitespace (interestingly, this does not happen, when selecting the additional whitespace manually with the cursor, so MS Word must have some internal extra flag for its selections…)

Would it be possible to create a similar behaviour for prosemirror on MS Windows, because right now, double click selection maybe implemented correctly, but not how users probably expect it to be.

1 Like

ProseMirror allows the browser’s native selection behavior to happen for double-click. I suppose having toggleMark shrink the selection when it starts or ends with whitespace would be reasonable. I’ve implemented that here.

1 Like

Thanks! I will try that out.