Codemirror 6 readOnly editor

I’m trying to set up a basic JSON code editor that can be readOnly.

This tells me that it can be done as an extension and I also found the readOnly prop

But I just can’t figure out how to glue things together :disappointed_relieved:

You need to use the readOnly facet as an extension in your view. For example, to set the editor as readOnly, you need to add this to your extensions:

EditorState.readOnly.of(true)

EditorState.readOnly.of(true)

hello, can i add it to EditorState after running extensions, as trigger - select readOnly / deselect readOnly
and how ? if you have some code example - please let me understand how it works )

See the configuration example.