Is it correct to reset selection to 1?

Hello. Sometimes prosemirror throws unexpected exceptions when the selection range is out of data scope. Is it correct to reset the selection on save event to 1? Will it work in all cases?


No, if there is no textblock right at the start of the document that will not be a valid selection.

Is it possible to disable selection on save / reset it to the beginning or end?

The library has no concept of ‘saving’, so depends on what you’re doing. You can use Selection.atStart to find a valid selection at the start of a document.