mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:53:41 +08:00
FIX: More safety for going back while stuff is uncloaking
This commit is contained in:
parent
8e382fa5ea
commit
3521fb97e4
|
@ -607,7 +607,12 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
|
||||||
postStream.prependMore().then(function() {
|
postStream.prependMore().then(function() {
|
||||||
Em.run.next(function () {
|
Em.run.next(function () {
|
||||||
$elem = $('#post-cloak-' + post.get('post_number'));
|
$elem = $('#post-cloak-' + post.get('post_number'));
|
||||||
$('html, body').scrollTop($elem.position().top + distToElement);
|
|
||||||
|
// Quickly going back might mean the element is destroyed
|
||||||
|
var position = $elem.position();
|
||||||
|
if (position && position.top) {
|
||||||
|
$('html, body').scrollTop(position.top + distToElement);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
5
vendor/assets/javascripts/ember-cloaking.js
vendored
5
vendor/assets/javascripts/ember-cloaking.js
vendored
|
@ -186,7 +186,7 @@
|
||||||
|
|
||||||
Em.run.schedule('afterRender', this, function() {
|
Em.run.schedule('afterRender', this, function() {
|
||||||
onscreenCloaks.forEach(function (v) {
|
onscreenCloaks.forEach(function (v) {
|
||||||
if(v && v.uncloak && (v._state || v.state) === 'inDOM') {
|
if(v && v.uncloak) {
|
||||||
v.uncloak();
|
v.uncloak();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -298,6 +298,9 @@
|
||||||
@method uncloak
|
@method uncloak
|
||||||
*/
|
*/
|
||||||
uncloak: function() {
|
uncloak: function() {
|
||||||
|
var state = this._state || this.state;
|
||||||
|
if (state !== 'inDOM' && state !== 'preRender') { return; }
|
||||||
|
|
||||||
if (!this._containedView) {
|
if (!this._containedView) {
|
||||||
var model = this.get('content'),
|
var model = this.get('content'),
|
||||||
controller = null,
|
controller = null,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user