diff --git a/core/client/assets/sass/layouts/editor.scss b/core/client/assets/sass/layouts/editor.scss index 507ce99426..83cef5178c 100644 --- a/core/client/assets/sass/layouts/editor.scss +++ b/core/client/assets/sass/layouts/editor.scss @@ -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;} } diff --git a/core/client/assets/sass/lib/codemirror.scss b/core/client/assets/sass/lib/codemirror.scss index a4efcdd229..60b60f655a 100644 --- a/core/client/assets/sass/lib/codemirror.scss +++ b/core/client/assets/sass/lib/codemirror.scss @@ -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; } -} \ No newline at end of file +} diff --git a/core/client/mixins/editor-base-view.js b/core/client/mixins/editor-base-view.js index c2858591b7..9fb2c1c473 100644 --- a/core/client/mixins/editor-base-view.js +++ b/core/client/mixins/editor-base-view.js @@ -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; }) });