mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Revert frame-writing stuff from #315, as it fails when the preview loads before the placeholder - see https://github.com/torchbox/wagtail/pull/315#issuecomment-46669595
This commit is contained in:
parent
b26744e137
commit
55cd5aad83
@ -329,9 +329,9 @@ $(function() {
|
||||
});
|
||||
|
||||
/* Set up behaviour of preview button */
|
||||
$('.action-preview').click(function(e) {
|
||||
$('.action-preview').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
var previewWindow = window.open($(this).data('placeholder'), $(this).data('windowname'));
|
||||
|
||||
$.ajax({
|
||||
@ -340,18 +340,9 @@ $(function() {
|
||||
data: $('#page-edit-form').serialize(),
|
||||
success: function(data, textStatus, request) {
|
||||
if (request.getResponseHeader('X-Wagtail-Preview') == 'ok') {
|
||||
var pdoc = previewWindow.document;
|
||||
var frame = pdoc.getElementById('preview-frame');
|
||||
|
||||
frame = frame.contentWindow || frame.contentDocument.document || frame.contentDocument;
|
||||
frame.document.open();
|
||||
frame.document.write(data);
|
||||
frame.document.close();
|
||||
|
||||
var hideTimeout = setTimeout(function(){
|
||||
pdoc.getElementById('loading-spinner-wrapper').className += 'remove';
|
||||
clearTimeout(hideTimeout);
|
||||
}, 50) // just enough to give effect without adding discernible slowness
|
||||
previewWindow.document.open();
|
||||
previewWindow.document.write(data);
|
||||
previewWindow.document.close();
|
||||
} else {
|
||||
previewWindow.close();
|
||||
document.open();
|
||||
|
@ -11,6 +11,5 @@
|
||||
<div id="loading-spinner-wrapper">
|
||||
<div id="loading-spinner"></div>
|
||||
</div>
|
||||
<iframe id="preview-frame" src="{% url 'wagtailadmin_pages_preview_loading' %}"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -50,7 +50,6 @@ urlpatterns += [
|
||||
url(r'^pages/(\d+)/edit/preview/$', pages.preview_on_edit, name='wagtailadmin_pages_preview_on_edit'),
|
||||
|
||||
url(r'^pages/preview/$', pages.preview, name='wagtailadmin_pages_preview'),
|
||||
url(r'^pages/preview_loading/$', pages.preview_loading, name='wagtailadmin_pages_preview_loading'),
|
||||
|
||||
url(r'^pages/(\d+)/view_draft/$', pages.view_draft, name='wagtailadmin_pages_view_draft'),
|
||||
url(r'^pages/(\d+)/add_subpage/$', pages.add_subpage, name='wagtailadmin_pages_add_subpage'),
|
||||
|
@ -420,12 +420,6 @@ def preview(request):
|
||||
"""
|
||||
return render(request, 'wagtailadmin/pages/preview.html')
|
||||
|
||||
def preview_loading(request):
|
||||
"""
|
||||
This page is blank, but must be real HTML so its DOM can be written to once the preview of the page has rendered
|
||||
"""
|
||||
return HttpResponse("<html><head><title></title></head><body></body></html>")
|
||||
|
||||
@permission_required('wagtailadmin.access_admin')
|
||||
def unpublish(request, page_id):
|
||||
page = get_object_or_404(Page, id=page_id)
|
||||
|
Loading…
Reference in New Issue
Block a user