Skip to content

Commit 0784d51

Browse files
committed
Update live-view.js
1 parent b10fc81 commit 0784d51

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

live-view/live-view.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,30 @@ function addBottomSwipeListener() {
441441

442442
} else { // if clicked and bottom float not expanded
443443

444+
// if clicked the bottom float's swipe hitbox
445+
// but not the bottom float itself
444446
if (e.target === bottomWrapper) {
445447

446448
console.log('click', e);
447449

450+
// get caret range from point
451+
452+
const pointX = e.touches[0].clientX,
453+
pointY = e.touches[0].clientY;
454+
455+
const range = document.caretRangeFromPoint(pointX, pointY);
456+
457+
// if range exists
458+
if (range) {
459+
460+
// select range
461+
462+
const sel = window.getSelection();
463+
464+
sel.addRange(range);
465+
466+
}
467+
448468
}
449469

450470
}

0 commit comments

Comments
 (0)