Skip to content

Commit 57ff41d

Browse files
committed
Use Selection.collapse in selectCursorWrapper
FIX: Work around a Safari issue that broke composition right after changing the set of active marks. Closes #184
1 parent 5daf445 commit 57ff41d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/selection.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,11 @@ function removeClassOnSelectionChange(view: EditorView) {
147147
}
148148

149149
function selectCursorWrapper(view: EditorView) {
150-
let domSel = view.domSelection(), range = document.createRange()
150+
let domSel = view.domSelection()
151151
if (!domSel) return
152152
let node = view.cursorWrapper!.dom, img = node.nodeName == "IMG"
153-
if (img) range.setStart(node.parentNode!, domIndex(node) + 1)
154-
else range.setStart(node, 0)
155-
range.collapse(true)
156-
domSel.removeAllRanges()
157-
domSel.addRange(range)
153+
if (img) domSel.collapse(node.parentNode!, domIndex(node) + 1)
154+
else domSel.collapse(node, 0)
158155
// Kludge to kill 'control selection' in IE11 when selecting an
159156
// invisible cursor wrapper, since that would result in those weird
160157
// resize handles and a selection that considers the absolutely

0 commit comments

Comments
 (0)