codemirror / dev

Development repository for the CodeMirror editor project
https://codemirror.net/
Other
5.94k stars 376 forks source link

Don't show mobile keyboard in readOnly mode #1435

Closed vijayth2-cerebras closed 2 months ago

vijayth2-cerebras commented 2 months ago

Describe the issue

Even when readOnly mode is true, mobile keyboard appears on touch. I don't want to show the mobile keyboard when in readonly mode.

const state = EditorState.create({
  doc: code,
  extensions: [
    basicSetup,
    EditorView.lineWrapping,
    EditorState.readOnly.of(true),
    languageExtn()
  ]
})
editorRef.current = new EditorView({
  state,
  parent: document.getElementById(id)!
})

Browser and platform

All mobile devices

Reproduction link

No response

marijnh commented 2 months ago

Use EditorView.editable.

vijayth2-cerebras commented 2 months ago

Thanks so much. It works great. If you can add it to the README, that will help.