From a563273fdbab42f7581696e5e911cbd38139394d Mon Sep 17 00:00:00 2001 From: Ian McDowell Date: Thu, 21 May 2015 17:01:19 -0700 Subject: [PATCH] Fix cursor top position in multi-cursor module when the quill container 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. --- src/modules/multi-cursor.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/multi-cursor.coffee b/src/modules/multi-cursor.coffee index 3fb36a5dd9..a954159a55 100644 --- a/src/modules/multi-cursor.coffee +++ b/src/modules/multi-cursor.coffee @@ -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')