AllSelection vs TextSelection behaviour?

I’m not sure if this is a bug or intended behaviour, but reporting it here in case of the former. We recently found that there’s some subtle differences between handling of the AllSelection (as created by selectAll) and a TextSelection created by explicitly selecting the whole document, due to a few places in the code that explicitly check for instanceof TextSelection.

For example, the test in MouseDown.up in view/src/input.js: ( && !(this.view.state.selection instanceof TextSelection) && (pos.pos == this.view.state.selection.from || pos.pos ==

appears to result in clicks at the top of the EditorView (but outside of the contenteditable area) setting the selection to (1,1) if the current selection is an AllSelection, but being ignored for a TextSelection.

FWIW my workaround atm is to just replace selectAll with a version that creates an equivalent TextSelection.

That’ll cause incomplete selections when your document starts or ends in a non-textblock node. Depending on your schema, that may or may not be an issue.

The patch below adjusts MouseDown.up to do the proper thing in this case.

Confirming that that change works for me, thanks!