mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-05 18:34:39 +03:00
Merge pull request #4034 from novaugust/iss4027
Fix editor scroll depending on cursor location
This commit is contained in:
commit
d5ddbfee5a
@ -212,7 +212,7 @@
|
||||
}
|
||||
|
||||
.CodeMirror-lines {
|
||||
padding: 65px 0 40px 0; /* Vertical padding around content */
|
||||
padding-top: 65px; /* Vertical padding around content */
|
||||
@media (max-width: 1000px) {padding-top: 25px;}
|
||||
@media (max-width: 400px) {padding: 15px 0;}
|
||||
}
|
||||
|
@ -98,8 +98,7 @@
|
||||
.CodeMirror-scroll {
|
||||
/* 30px is the magic margin used to hide the element's real scrollbars */
|
||||
/* See overflow: hidden in .CodeMirror */
|
||||
margin-bottom: -30px; margin-right: -30px;
|
||||
padding-bottom: 30px; padding-right: 30px;
|
||||
margin-right: -30px; padding-right: 30px;
|
||||
height: 100%;
|
||||
outline: none; /* Prevent dragging from highlighting the element */
|
||||
position: relative;
|
||||
@ -204,4 +203,4 @@
|
||||
.CodeMirror div.CodeMirror-cursor {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,18 +40,16 @@ var EditorViewMixin = Ember.Mixin.create({
|
||||
}
|
||||
|
||||
var scrollInfo = this.get('markdownScrollInfo'),
|
||||
codemirror = scrollInfo.codemirror,
|
||||
markdownHeight = scrollInfo.height - scrollInfo.clientHeight,
|
||||
previewHeight = this.get('$previewContent').height() - this.get('$previewViewPort').height(),
|
||||
ratio = previewHeight / markdownHeight,
|
||||
previewPosition = scrollInfo.top * ratio,
|
||||
isCursorAtEnd = codemirror.getCursor('end').line > codemirror.lineCount() - 5;
|
||||
markdownHeight,
|
||||
previewHeight,
|
||||
ratio;
|
||||
|
||||
if (isCursorAtEnd) {
|
||||
previewPosition = previewHeight + 30;
|
||||
}
|
||||
markdownHeight = scrollInfo.height - scrollInfo.clientHeight;
|
||||
previewHeight = this.get('$previewContent').height() - this.get('$previewViewPort').height();
|
||||
|
||||
return previewPosition;
|
||||
ratio = previewHeight / markdownHeight;
|
||||
|
||||
return scrollInfo.top * ratio;
|
||||
})
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user