Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Only load preview panel if its visible, to avoid unnecessary as…

…set loads and processing. Only refresh edit form view from preview events when its visible.
  • Loading branch information...
commit 11b3b43c8413984fbfe98ae9eb49946fde35f8a8 1 parent f1f8dcd
@chillu chillu authored
View
15 admin/javascript/LeftAndMain.Preview.js
@@ -37,10 +37,16 @@
this.find('iframe').addClass('center');
this.find('iframe').bind('load', function() {
self._fixIframeLinks();
- self.loadCurrentPage();
+
+ // Load edit view for new page, but only if the preview is activated at the moment.
+ // This avoids e.g. force-redirections of the edit view on RedirectorPage instances.
+ if(!self.is('.is-collapsed')) self.loadCurrentPage();
});
var updateAfterXhr = function() {
+ // Only load when panel is visible (see details in iframe load event handler).
+ if(self.is('.is-collapsed')) return;
+
// var url = ui.xmlhttp.getResponseHeader('x-frontend-url');
var url = $('.cms-edit-form').find(':input[name=StageURLSegment]').val();
if(url) {
@@ -241,7 +247,12 @@
onclick: function(e) {
e.preventDefault();
- $('.cms-preview').toggle();
+ var preview = $('.cms-preview'), url = $('.cms-edit-form').find(':input[name=StageURLSegment]').val();
+ if(url) {
+ preview.loadUrl(url);
+ preview.unblock();
+ preview.toggle();
+ }
}
});
});
View
2  admin/templates/LeftAndMain.ss
@@ -17,7 +17,7 @@
$Content
<div class="cms-preview east <% if IsPreviewExpanded %>is-expanded<% else %>is-collapsed<% end_if %>" data-layout="{type: 'border'}">
- <iframe src="<% if $PreviewLink %>$PreviewLink<% else %>about:blank<% end_if %>" class="center"></iframe>
+ <iframe src="about:blank" class="center"></iframe>
<div class="cms-preview-controls south"></div>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.