Skip to content

Commit

Permalink
Fix paste-manager scrollIntoView() behavior
Browse files Browse the repository at this point in the history
The previous logic assumed that @quill.container was a fixed height.
Fixed by using the viewport-relative offset given by getBoundingClientRect().
  • Loading branch information
thomsbg committed Dec 4, 2014
1 parent a18b142 commit d6dee28
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/paste-manager.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
)

Expand Down

0 comments on commit d6dee28

Please sign in to comment.