Skip to content

Commit

Permalink
Fix a regression around selection of uneditable content on mobile
Browse files Browse the repository at this point in the history
FIX: Fix a regression that caused touch selection on mobile platforms to not
work in an uneditable editor.

See https://discuss.codemirror.net/t/readonly-mode-using-editorview-editable-of-false-does-not-allow-selecting-content-in-mobile-browsers/5482/1
  • Loading branch information
marijnh committed Jan 4, 2023
1 parent 5875d32 commit a403e7c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/domchange.ts
Expand Up @@ -67,7 +67,7 @@ export function applyDOMChange(view: EditorView, domChange: DOMChange): boolean
change = {from: from + diff.from, to: from + diff.toA,
insert: Text.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder))}
}
} else if (newSel && (!view.hasFocus || !view.state.facet(editable) || newSel.main.eq(sel))) {
} else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) {
newSel = null
}

Expand Down

0 comments on commit a403e7c

Please sign in to comment.