UX: Composer textarea should always start at the top.

This commit is contained in:
Guo Xiang Tan 2017-11-24 23:24:37 +08:00
parent 3c60702663
commit f3f051a344
1 changed files with 14 additions and 10 deletions

View File

@ -136,20 +136,24 @@ export default Ember.Component.extend({
this.appEvents.on(event, this, this._resetShouldBuildScrollMap);
});
$input.on('touchstart mouseenter', () => {
if (!$preview.is(":visible")) return;
$preview.off('scroll');
Ember.run.schedule("afterRender", () => {
$input.scrollTop(0);
$input.on('scroll', () => {
this._syncScroll(this._syncEditorAndPreviewScroll, $input, $preview);
$input.on('touchstart mouseenter', () => {
if (!$preview.is(":visible")) return;
$preview.off('scroll');
$input.on('scroll', () => {
this._syncScroll(this._syncEditorAndPreviewScroll, $input, $preview);
});
});
});
$preview.on('touchstart mouseenter', () => {
$input.off('scroll');
$preview.on('touchstart mouseenter', () => {
$input.off('scroll');
$preview.on('scroll', () => {
this._syncScroll(this._syncPreviewAndEditorScroll, $input, $preview);
$preview.on('scroll', () => {
this._syncScroll(this._syncPreviewAndEditorScroll, $input, $preview);
});
});
});
},