mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 18:54:13 +08:00
UX: Sync input and preview when user is typing.
This commit is contained in:
parent
3334a4b539
commit
de17a8e856
|
@ -137,8 +137,6 @@ export default Ember.Component.extend({
|
|||
});
|
||||
|
||||
Ember.run.schedule("afterRender", () => {
|
||||
$input.scrollTop(0);
|
||||
|
||||
$input.on('touchstart mouseenter', () => {
|
||||
if (!$preview.is(":visible")) return;
|
||||
$preview.off('scroll');
|
||||
|
@ -146,6 +144,14 @@ export default Ember.Component.extend({
|
|||
$input.on('scroll', () => {
|
||||
this._syncScroll(this._syncEditorAndPreviewScroll, $input, $preview);
|
||||
});
|
||||
|
||||
$input.on('keypress', () => {
|
||||
Ember.run.debounce(
|
||||
this,
|
||||
this._syncScroll, this._syncEditorAndPreviewScroll, $input, $preview,
|
||||
200
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
$preview.on('touchstart mouseenter', () => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user