mirror of
https://github.com/discourse/discourse.git
synced 2025-02-18 01:05:00 +00:00
Don't sync scroll when input is not scrollable.
https://meta.discourse.org/t/composer-preview-scroll-not-syncing-with-editor/74975/14?u=tgxworld
This commit is contained in:
parent
1376a86bcc
commit
2e860eddc1
@ -254,8 +254,12 @@ export default Ember.Component.extend({
|
|||||||
|
|
||||||
_syncEditorAndPreviewScroll($input, $preview, scrollMap) {
|
_syncEditorAndPreviewScroll($input, $preview, scrollMap) {
|
||||||
let scrollTop;
|
let scrollTop;
|
||||||
|
const inputHeight = $input.height();
|
||||||
|
const inputScrollHeight = $input[0].scrollHeight;
|
||||||
|
const inputClientHeight = $input[0].clientHeight;
|
||||||
|
const scrollable = inputScrollHeight > inputClientHeight;
|
||||||
|
|
||||||
if (($input.height() + $input.scrollTop() + 100) > $input[0].scrollHeight) {
|
if (scrollable && ((inputHeight + $input.scrollTop() + 100) > inputScrollHeight)) {
|
||||||
scrollTop = $preview[0].scrollHeight;
|
scrollTop = $preview[0].scrollHeight;
|
||||||
} else {
|
} else {
|
||||||
const lineHeight = parseFloat($input.css('line-height'));
|
const lineHeight = parseFloat($input.css('line-height'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user