Edit book: When syncing the position of the preview panel to the cursor

in the editor and the cursor is at or before the <body> tag set the
position of the preview panel to the top of the file, so that the top
margin of the body tag is seen easily.
This commit is contained in:
Kovid Goyal 2013-12-15 09:25:49 +05:30
parent 4bd730cca6
commit 30deb207e4
2 changed files with 4 additions and 1 deletions

Binary file not shown.

View File

@ -56,7 +56,10 @@ class PreviewIntegration
for node in document.querySelectorAll('[data-lnum="' + lnum + '"]')
if is_hidden(node)
continue
node.scrollIntoView()
if node is document.body
window.scrollTo(0, 0)
else
node.scrollIntoView()
return
line_numbers: () =>