From 30deb207e42b0e121a64705cc68ade48aca08ea9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 15 Dec 2013 09:25:49 +0530 Subject: [PATCH] Edit book: When syncing the position of the preview panel to the cursor in the editor and the cursor is at or before the 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. --- resources/compiled_coffeescript.zip | Bin 78402 -> 78502 bytes src/calibre/ebooks/oeb/polish/preview.coffee | 5 ++++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/compiled_coffeescript.zip b/resources/compiled_coffeescript.zip index 6f4418df74e6e897d025e1ef21caf0fe31e34ed0..b8b57bf86a1918c87cf9833b99ebfb5dc9d98fea 100644 GIT binary patch delta 270 zcmX@~gk{-N7MTEVW)=|!5ZLO~?|gCEWup*r1_lt8VVG`U$SAVWpo43&!w(k8y!@0@ z1zTHNg_Qi{(%jU%61}ASluAv7>d7^g(v#2R^G~k&EIfG!m;7WNHLl6GnnfnB@8Fz# zTTrH1fP1?DH=~^jAF378WAquLnES*TrXK{_GySYSqbc(_T?lXTY+b(T>IRHj%!|#T zA_e9g(+fZ%?31B7HX1ORFf-4E%3qknF`dPbQHwEmy1pT!2lJ*)P>K3YY}2QJBo0mA dZ^-Dyyi|d4x}hPX@N{`2Mp?FH`iwx&0|56NQM>>E delta 200 zcmZ4Xl;zM97U=+QW)=|!5ZIj4?(95UL+^ta0|N-lOuwklD8JFFj%%_IxBTSWe?*%7 zxwrdsGbXF>p{kvJK%X&+NlSd1A*1Nz{o>ryZ44N-n6h-i{QtUq)4M@@dvg$f`WXX8 zBc{cZfNW2u`E$TR35Gx+&ehWoDlm#np1YcJ`bI;bdcRFz$xnui2F!87jMEtn8AYaB V8ZnwMI!@0sVl-lN(q{xZ8vvyeIPw4h diff --git a/src/calibre/ebooks/oeb/polish/preview.coffee b/src/calibre/ebooks/oeb/polish/preview.coffee index 81448bb1d5..d0f155e079 100644 --- a/src/calibre/ebooks/oeb/polish/preview.coffee +++ b/src/calibre/ebooks/oeb/polish/preview.coffee @@ -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: () =>