diff --git a/core/quill.ts b/core/quill.ts index 46fafeec7e..1f0e9f1b4d 100644 --- a/core/quill.ts +++ b/core/quill.ts @@ -650,7 +650,7 @@ class Quill { [index, length, , source] = overload(index, length, source); this.selection.setRange(new Range(Math.max(0, index), length), source); if (source !== Emitter.sources.SILENT) { - this.selection.scrollIntoView(this.scrollingContainer); + this.scrollIntoView(); } } } diff --git a/core/selection.ts b/core/selection.ts index 0011e82e66..f68d877d0b 100644 --- a/core/selection.ts +++ b/core/selection.ts @@ -331,13 +331,6 @@ class Selection { if (range == null) return; const bounds = this.getBounds(range.index, range.length); if (bounds == null) return; - const limit = this.scroll.length() - 1; - const [first] = this.scroll.line(Math.min(range.index, limit)); - let last = first; - if (range.length > 0) { - [last] = this.scroll.line(Math.min(range.index + range.length, limit)); - } - if (first == null || last == null) return; const scrollBounds = scrollingContainer.getBoundingClientRect(); if (bounds.top < scrollBounds.top) { scrollingContainer.scrollTop -= scrollBounds.top - bounds.top;