From d6dee28bf89ef672b5012fa652502e41711a1e71 Mon Sep 17 00:00:00 2001 From: Blake Thomson Date: Thu, 20 Nov 2014 12:15:58 -0500 Subject: [PATCH] Fix paste-manager scrollIntoView() behavior The previous logic assumed that @quill.container was a fixed height. Fixed by using the viewport-relative offset given by getBoundingClientRect(). --- src/modules/paste-manager.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/paste-manager.coffee b/src/modules/paste-manager.coffee index 89bc82f25a..5dfac2625c 100644 --- a/src/modules/paste-manager.coffee +++ b/src/modules/paste-manager.coffee @@ -27,9 +27,9 @@ class PasteManager @quill.setSelection(range.start + lengthAdded, range.start + lengthAdded) # Make sure bottom of pasted content is visible [line, offset] = @quill.editor.doc.findLineAt(range.start + lengthAdded) - lineBottom = line.node.offsetTop + line.node.offsetHeight - editorBottom = @quill.container.scrollTop + @quill.container.offsetHeight - line.node.scrollIntoView(false) if lineBottom > editorBottom + lineBottom = line.node.getBoundingClientRect().bottom + windowBottom = document.documentElement.clientHeight + line.node.scrollIntoView(false) if lineBottom > windowBottom @container.innerHTML = "" )