Closed Saul-Mirone closed 3 years ago
A gentle ping... @benrbray
Thanks for the PR! And my apologies for the very late review. I cloned your branch, but unfortunately I wasn't able to replicate the desired read-only behavior with your change. Would you be able to explain how to set up a read-only editor using this change?
In particular, I tried setting the editor DOM element's contentEditable="false"
as well as setting EditorView.editable = false
. In both cases, the ProseMirror editor was still active and in the MathView.selectNode()
function, this._outerEditor.editable
was logged as true
.
Thanks for the PR! And my apologies for the very late review. I cloned your branch, but unfortunately I wasn't able to replicate the desired read-only behavior with your change. Would you be able to explain how to set up a read-only editor using this change?
In particular, I tried setting the editor DOM element's
contentEditable="false"
as well as settingEditorView.editable = false
. In both cases, the ProseMirror editor was still active and in theMathView.selectNode()
function,this._outerEditor.editable
was logged astrue
.
Hi Benrbray, thanks for reviewing, according to this document, it seems that you should do this to enable the readOnly mode:
let view = new EditorView({
state: myState,
editable() { return false }, // Enables read-only behavior
})
BTW, you can also find this example in prosemirror's official guide
Another gentle ping... @benrbray
Everything seems to work OK, I'll merge and publish a new npm version. Thanks for the PR!
23