uiwjs / uiwjs/react-codemirror
Readonly crashes 'RangeError: Selection points outside of document' without Editable prop
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
Hi there!
When I'm confugiring that a user cannot write in editor, I used to use readonly prop. However, It was still possible to create selection which may point ouside of document as in Video 1, link below, HEADPHONE WARNING. However, when I also add editable prop to be editable={!isReadonly}, everything works fine, Image 1.
The props of CodeMirror is a bit confusing since it has two explicit props.
Image 1:

In the video below, because I had only readOnly={false} prop, it broke. If I add editable={!isReadOnly} prop, everything works fine.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the crash in the CodeMirror component using only the readOnly prop, then compare it with the editable={!isReadonly} configuration shown in the issue. Trace how those two props affect selection handling and verify that creating a selection outside the document no longer raises the reported RangeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100