Skip to content

Commit d2f689f

Browse files
luinjhchen
authored andcommitted
Refactor Selection#scrollIntoView()
1 parent 6159f64 commit d2f689f

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

core/quill.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ class Quill {
650650
[index, length, , source] = overload(index, length, source);
651651
this.selection.setRange(new Range(Math.max(0, index), length), source);
652652
if (source !== Emitter.sources.SILENT) {
653-
this.selection.scrollIntoView(this.scrollingContainer);
653+
this.scrollIntoView();
654654
}
655655
}
656656
}

core/selection.ts

-7
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,6 @@ class Selection {
331331
if (range == null) return;
332332
const bounds = this.getBounds(range.index, range.length);
333333
if (bounds == null) return;
334-
const limit = this.scroll.length() - 1;
335-
const [first] = this.scroll.line(Math.min(range.index, limit));
336-
let last = first;
337-
if (range.length > 0) {
338-
[last] = this.scroll.line(Math.min(range.index + range.length, limit));
339-
}
340-
if (first == null || last == null) return;
341334
const scrollBounds = scrollingContainer.getBoundingClientRect();
342335
if (bounds.top < scrollBounds.top) {
343336
scrollingContainer.scrollTop -= scrollBounds.top - bounds.top;

0 commit comments

Comments
 (0)