mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIX Dont update preview iframe if hidden
Updating the iframe src when the iframe isnt visible in IE8 causes a view disconcerting font glitch (and it slows down navigation anyway), so if the iframe isnt visible, delay setting the src until it is
This commit is contained in:
parent
c59305d6d4
commit
0ca4969cda
@ -104,9 +104,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate what columns are already hidden pre-layout
|
||||
var prehidden = {
|
||||
content: spec.content.hasClass('column-hidden'),
|
||||
preview: spec.preview.hasClass('column-hidden')
|
||||
};
|
||||
|
||||
// Calculate what columns will be hidden (zero width) post-layout
|
||||
var posthidden = {
|
||||
content: contentWidth === 0,
|
||||
preview: previewWidth === 0
|
||||
};
|
||||
|
||||
// Apply classes for elements that might not be visible at all.
|
||||
spec.content.toggleClass('column-hidden', contentWidth===0);
|
||||
spec.preview.toggleClass('column-hidden', previewWidth===0);
|
||||
spec.content.toggleClass('column-hidden', posthidden.content);
|
||||
spec.preview.toggleClass('column-hidden', posthidden.preview);
|
||||
|
||||
// Apply the widths to columns, and call subordinate layouts to arrange the children.
|
||||
menu.bounds({'x': left, 'y': top, 'height': bottom - top, 'width': menuWidth});
|
||||
@ -115,12 +127,15 @@
|
||||
left += menuWidth;
|
||||
|
||||
content.bounds({'x': left, 'y': top, 'height': bottom - top, 'width': contentWidth});
|
||||
content.doLayout();
|
||||
if (!posthidden.content) content.doLayout();
|
||||
|
||||
left += contentWidth;
|
||||
|
||||
preview.bounds({'x': left, 'y': top, 'height': bottom - top, 'width': previewWidth});
|
||||
preview.doLayout();
|
||||
if (!posthidden.preview) preview.doLayout();
|
||||
|
||||
if (posthidden.content !== prehidden.content) spec.content.trigger('columnvisibilitychanged');
|
||||
if (posthidden.preview !== prehidden.preview) spec.preview.trigger('columnvisibilitychanged');
|
||||
|
||||
return container;
|
||||
};
|
||||
|
@ -198,6 +198,7 @@
|
||||
* Caveat: the preview will be automatically enabled when ".cms-previewable" class is detected.
|
||||
*/
|
||||
disablePreview: function() {
|
||||
this.setPendingURL(null);
|
||||
this._loadUrl('about:blank');
|
||||
this._block();
|
||||
this.changeMode('content', false);
|
||||
@ -304,6 +305,18 @@
|
||||
}
|
||||
},
|
||||
|
||||
/** @var string A URL that should be displayed in this preview panel once it becomes visible */
|
||||
PendingURL: null,
|
||||
|
||||
oncolumnvisibilitychanged: function() {
|
||||
var url = this.getPendingURL();
|
||||
if (url && !this.is('.column-hidden')) {
|
||||
this.setPendingURL(null);
|
||||
this._loadUrl(url);
|
||||
this._unblock();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update preview whenever a form is submitted.
|
||||
* This is an alternative to the LeftAndmMain::loadPanel functionality which we already
|
||||
@ -369,20 +382,37 @@
|
||||
});
|
||||
}
|
||||
|
||||
var url = null;
|
||||
|
||||
if (currentState[0]) {
|
||||
// State is available on the newly loaded content. Get it.
|
||||
this._loadUrl(currentState[0].url);
|
||||
this._unblock();
|
||||
url = currentState[0].url;
|
||||
} else if (states.length) {
|
||||
// Fall back to the first available content state.
|
||||
this.setCurrentStateName(states[0].name);
|
||||
this._loadUrl(states[0].url);
|
||||
this._unblock();
|
||||
url = states[0].url;
|
||||
} else {
|
||||
// No state available at all.
|
||||
this.setCurrentStateName(null);
|
||||
}
|
||||
|
||||
// If this preview panel isn't visible at the moment, delay loading the URL until it (maybe) is later
|
||||
if (this.is('.column-hidden')) {
|
||||
this.setPendingURL(url);
|
||||
this._loadUrl('about:blank');
|
||||
this._block();
|
||||
}
|
||||
else {
|
||||
this.setPendingURL(null);
|
||||
|
||||
if (url) {
|
||||
this._loadUrl(url);
|
||||
this._unblock();
|
||||
}
|
||||
else {
|
||||
this._block();
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user