From edfe3d0ce2726e90559b200f607dc0dec48526b9 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Mon, 2 Feb 2015 08:27:27 +0000 Subject: Visual/edit modes: WIP, scrolling content editable. --- content_scripts/mode_visual_edit.coffee | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'content_scripts/mode_visual_edit.coffee') diff --git a/content_scripts/mode_visual_edit.coffee b/content_scripts/mode_visual_edit.coffee index 82e2b189..749559f7 100644 --- a/content_scripts/mode_visual_edit.coffee +++ b/content_scripts/mode_visual_edit.coffee @@ -437,7 +437,15 @@ class Movement extends CountPrefix if @element and DomUtils.isEditable @element if @element.clientHeight < @element.scrollHeight if @element.isContentEditable - # Help(smblott)! How do we do this? This case matters for Gmail and Google's inbox. + # WIP... + elementWithFocus = DomUtils.getElementWithFocus @selection, @getDirection() == backward + console.log elementWithFocus.innerHTML + position = elementWithFocus.getClientRects()[0].top - @element.getClientRects()[0].top + console.log "top", position + Scroller.scrollToPosition @element, position, 0 + position = elementWithFocus.getClientRects()[0].bottom - @element.getClientRects()[0].top + console.log "bottom", position + Scroller.scrollToPosition @element, position, 0 else position = if @getDirection() == backward then @element.selectionStart else @element.selectionEnd coords = DomUtils.getCaretCoordinates @element, position -- cgit v1.2.3