What is the current equivalent of CM5 doc.markText#readOnly?

I’m searching for a way to lock certain areas of a given template. For CodeMirror 5 I’ve found this option:

Text-marking methods

doc.markText(from: {line, ch}, to: {line, ch}, ?options: object) → TextMarker
Can be used to mark a range of text with a specific CSS class name. from and to should be {line, ch} objects. The options parameter is optional. When given, it should be an object that may contain the following configuration options:

readOnly: boolean
A read-only span can, as long as it is not cleared, not be modified except by calling setValue to reset the whole document. Note: adding a read-only span currently clears the undo history of the editor, because existing undo events being partially nullified by read-only spans would corrupt the history (in the current implementation).

What is the current equivalent for CodeMirror 6 to mark sections read-only and apply these sections some stylings at the same time too? Searching the documentation of CM6 for mark gives 7 matches, all about decorations and highlights but none to set areas to read-only.

Many thanks for any help,

Something like that is done with a change filter in version 6.

Well, so since a fully replacement is not available I guess I have to code it from scratch by myself. Seems a bit sad, but on the other hand it will probably help me to get a deeper understanding of the editor.

Thanks for the answer