diff --git a/core/modules/responsive_preview/js/responsive-preview.js b/core/modules/responsive_preview/js/responsive-preview.js index ab43308..b55772a 100644 --- a/core/modules/responsive_preview/js/responsive-preview.js +++ b/core/modules/responsive_preview/js/responsive-preview.js @@ -9,6 +9,8 @@ var previewModel, tabModel, appView, tabView, blockView, keyboardView; +var currentPath; + /** * Attaches behaviors to the toolbar tab and preview containers. */ @@ -18,6 +20,9 @@ Drupal.behaviors.responsivePreview = { // elements are found. window and window.parent are equivalent unless the // Drupal page is itself wrapped in an iframe. var $body = $(window.parent.document.body).once('responsive-preview'); + // Store the current path. The drupalSettings.currentPath changes whenever + // an AJAX request is sent, so we save it on the first process of attach. + currentPath = currentPath || drupalSettings.currentPath; if ($body.length) { var options = $.extend(this.defaults, drupalSettings.responsivePreview || {}); @@ -545,7 +550,7 @@ Drupal.responsivePreview = Drupal.responsivePreview || { var $frame = $(Drupal.theme('responsivePreviewFrame')) .attr({ 'data-loading': true, - src: drupalSettings.basePath + Drupal.encodePath(drupalSettings.currentPath), + src: drupalSettings.basePath + Drupal.encodePath(currentPath), width: '100%', height: '100%' })