I just released codemirror-readonly-ranges extension that easy allow to work with read-only ranges on CodeMirror6.
For anyone who is interested on the solution:
package: https://www.npmjs.com/package/codemirror-readonly-ranges
full documentation: https://andrebnassis.github.io/codemirror-readonly-ranges