Prosemirror doesn't look like to have a readOnly option to disable editing. It could be useful to prevent modification while still displaying the editor.
This option could be implementing by toggling the contenteditable attribute.
If you simply toggle contentEditable, ProseMirror's key handlers will still be updating your document for a lot of keys. See this discussion and this event handler
Note to future web travellers passing by this place: the editable prop might be what you're looking for.
const disabled = this.disabled;
this.view = new EditorView(el, {
state: this.state,
dispatchTransaction: this.dispatch,
nodeViews: this.nodeViews,
attributes,
editable() {
return !disabled;
},
});
Most helpful comment
Note to future web travellers passing by this place: the editable prop might be what you're looking for.