PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.4
Elementor Website Builder – more than just a page builder v4.2.4
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/preview.php +18 -0 4.0.94.2.4 View file →
@@ -1,8 +1,9 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 4 use Elementor\Core\Base\App;
5 +use Elementor\Core\Editor\Editor;
5 6 use Elementor\Core\Settings\Manager as SettingsManager;
6 7
7 8 if ( ! defined( 'ABSPATH' ) ) {
8 9 exit; // Exit if accessed directly.
@@ -92,8 +93,13 @@
92 93
93 94 $this->post_id = get_the_ID();
94 95 $this->is_preview = true;
95 96
97 + // Send Document-Isolation-Policy on the preview iframe so it shares
98 + // an agent cluster with the editor parent and synchronous DOM access
99 + // (e.g. iframe.contentWindow.elementorFrontend) keeps working.
100 + Editor::send_document_isolation_policy_header();
101 +
96 102 // Don't redirect to permalink.
97 103 remove_action( 'template_redirect', 'redirect_canonical' );
98 104
99 105 // Compatibility with Yoast SEO plugin when 'Removes unneeded query variables from the URL' enabled.
@@ -191,8 +197,20 @@
191 197 return false;
192 198 }
193 199
194 200 return true;
201 + }
202 +
203 + /**
204 + * Whether WordPress post preview or Elementor preview iframe is active.
205 + *
206 + * @since 4.1.0
207 + * @access public
208 + *
209 + * @return bool
210 + */
211 + public function is_editor_or_preview() {
212 + return is_preview() || $this->is_preview_mode();
195 213 }
196 214
197 215 /**
198 216 * Builder wrapper.