Skip to content

Commit

Permalink
Fix cursor top position in multi-cursor module when the quill container
Browse files Browse the repository at this point in the history
is scrolled.

Cursors are absolutely positioned with respect to the top of the
.ql-container.
quill.getBounds().top returns a smaller integer when the .ql-container
is scrolled vertically.
As a result, positioning a cursor requires adding container.scrollTop to
the cursor bounds.
  • Loading branch information
igmcdowell committed May 22, 2015
1 parent 1b6721c commit a563273
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/multi-cursor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class MultiCursor extends EventEmitter2

_updateCursor: (cursor) ->
bounds = @quill.getBounds(cursor.index)
cursor.elem.style.top = (bounds.top - @quill.container.scrollTop) + 'px'
cursor.elem.style.top = (bounds.top + @quill.container.scrollTop) + 'px'
cursor.elem.style.left = bounds.left + 'px'
cursor.elem.style.height = bounds.height + 'px'
flag = cursor.elem.querySelector('.cursor-flag')
Expand Down

0 comments on commit a563273

Please sign in to comment.