I am trying to make the editor read-only and non-editable. For that I am using EditorState.readOnly as well as EditorView.editable to configure it but it doesn't work and I was wondering if I am doing something wrong.
Here's my code:
import {minimalSetup, EditorView} from "codemirror"
import {EditorState} from "@codemirror/state"
new EditorView({
doc: "You should not be able to edit this",
extensions: [
EditorView.editable.of([false]),
EditorState.readOnly.of([true]),
],
parent: document.body
});
Describe the issue
I am trying to make the editor read-only and non-editable. For that I am using
EditorState.readOnly
as well asEditorView.editable
to configure it but it doesn't work and I was wondering if I am doing something wrong.Here's my code:
Update: Seems to work in Firefox.
Browser and platform
Chrome Version 126.0.6478.127
Reproduction link
https://codemirror.net/try/?c=aW1wb3J0IHttaW5pbWFsU2V0dXAsIEVkaXRvclZpZXd9IGZyb20gImNvZGVtaXJyb3IiCmltcG9ydCB7RWRpdG9yU3RhdGV9IGZyb20gIkBjb2RlbWlycm9yL3N0YXRlIgoKbmV3IEVkaXRvclZpZXcoewogIGRvYzogIllvdSBzaG91bGQgbm90IGJlIGFibGUgdG8gZWRpdCB0aGlzIiwKICBleHRlbnNpb25zOiBbCiAgICBFZGl0b3JWaWV3LmVkaXRhYmxlLm9mKFtmYWxzZV0pLAogICAgRWRpdG9yU3RhdGUucmVhZE9ubHkub2YoW3RydWVdKSwKICBdLAogIHBhcmVudDogZG9jdW1lbnQuYm9keQp9KQo=