In CM6, EditorView.editable.of(false) disables focus and cursor, whereas EditorState.readOnly.of(true) keeps focus and cursor enabled, so that in this second case typing advances the cursor but does not alter document content.
I found that, if I type past the final char in a document having EditorState.readOnly.of(true), this (1) triggers the error RangeError: Selection points outside of document (stack trace below) and (2) whatever was typed is actually added to the document.
Is being able to type past document length in read-only mode a bug?
If not a bug, how can I preempt the error and the addition? I have tried filtering out with EditorView.updateListener.of() and EditorState.transactionFilter.of() but in both cases, the error above is triggered before these hooks get a chance to be called.
For more context, my only registered extension is EditorState.readOnly.of(true). Searching the forum, the only seemingly relevant thread is this, but they were not triggering the error by using EditorState.readOnly.of(true).
Stack trace for reference
RangeError: Selection points outside of document
checkSelection index.js:1541
Transaction index.js:2240
create index.js:2248
resolveTransaction index.js:2421
update index.js:2593
dispatch index.js:6277
applyDOMChange index.js:5654
flush index.js:6056
observer index.js:5765
DOMObserver index.js:5748
EditorView index.js:6217
mounted ExpressionModalOutput.vue:54
VueJS 17
reload plugin-vue2:hmr-runtime:187
reload plugin-vue2:hmr-runtime:185
tryWrap plugin-vue2:hmr-runtime:60
<anonymous> ExpressionModalOutput.vue:96
accept client.ts:424
fetchUpdate client.ts:340
queueUpdate client.ts:195
queueUpdate client.ts:195
handleMessage client.ts:74
handleMessage client.ts:72
<anonymous> client.ts:45
EventListener.handleEvent* client.ts:44
main.ts:59:10
Thank you very much for your time.