0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Make scroll on enter logic independent of CSS.

Fixes #149.
This commit is contained in:
Neil Jenkins 2015-10-23 17:05:32 +01:00
parent 85c9002ce5
commit 162ec9049e
3 changed files with 8 additions and 12 deletions

View file

@ -1395,11 +1395,9 @@ var keyHandlers = {
if ( nodeAfterSplit.nodeType === TEXT_NODE ) { if ( nodeAfterSplit.nodeType === TEXT_NODE ) {
nodeAfterSplit = nodeAfterSplit.parentNode; nodeAfterSplit = nodeAfterSplit.parentNode;
} }
var doc = self._doc, // 16 ~ one standard line height in px.
body = self._body; if ( nodeAfterSplit.getBoundingClientRect().top + 16 >
if ( nodeAfterSplit.offsetTop + nodeAfterSplit.offsetHeight > self._doc.documentElement.clientHeight ) {
( doc.documentElement.scrollTop || body.scrollTop ) +
body.offsetHeight ) {
nodeAfterSplit.scrollIntoView( false ); nodeAfterSplit.scrollIntoView( false );
} }
}, },

File diff suppressed because one or more lines are too long

View file

@ -246,11 +246,9 @@ var keyHandlers = {
if ( nodeAfterSplit.nodeType === TEXT_NODE ) { if ( nodeAfterSplit.nodeType === TEXT_NODE ) {
nodeAfterSplit = nodeAfterSplit.parentNode; nodeAfterSplit = nodeAfterSplit.parentNode;
} }
var doc = self._doc, // 16 ~ one standard line height in px.
body = self._body; if ( nodeAfterSplit.getBoundingClientRect().top + 16 >
if ( nodeAfterSplit.offsetTop + nodeAfterSplit.offsetHeight > self._doc.documentElement.clientHeight ) {
( doc.documentElement.scrollTop || body.scrollTop ) +
body.offsetHeight ) {
nodeAfterSplit.scrollIntoView( false ); nodeAfterSplit.scrollIntoView( false );
} }
}, },