PluginProbe
Elementor Website Builder – more than just a page builder / 3.5.6
Elementor Website Builder – more than just a page builder v3.5.6
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 +14 -37 4.2.43.5.6 View file →
@@ -1,10 +1,8 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 4 use Elementor\Core\Base\App;
5 -use Elementor\Core\Editor\Editor;
6 -use Elementor\Core\Settings\Manager as SettingsManager;
7 5
8 6 if ( ! defined( 'ABSPATH' ) ) {
9 7 exit; // Exit if accessed directly.
10 8 }
@@ -19,13 +17,8 @@
19 17 */
20 18 class Preview extends App {
21 19
22 20 /**
23 - * The priority of the preview enqueued styles.
24 - */
25 - const ENQUEUED_STYLES_PRIORITY = 20;
26 -
27 - /**
28 21 * Is Preview.
29 22 *
30 23 * Holds a flag if current request is a preview.
31 24 * The flag is not related to a specific post or edit permissions.
@@ -93,13 +86,8 @@
93 86
94 87 $this->post_id = get_the_ID();
95 88 $this->is_preview = true;
96 89
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 -
102 90 // Don't redirect to permalink.
103 91 remove_action( 'template_redirect', 'redirect_canonical' );
104 92
105 93 // Compatibility with Yoast SEO plugin when 'Removes unneeded query variables from the URL' enabled.
@@ -113,9 +101,9 @@
113 101
114 102 add_action( 'wp_enqueue_scripts', function() {
115 103 $this->enqueue_styles();
116 104 $this->enqueue_scripts();
117 - }, self::ENQUEUED_STYLES_PRIORITY );
105 + } );
118 106
119 107 add_filter( 'the_content', [ $this, 'builder_wrapper' ], 999999 );
120 108
121 109 add_action( 'wp_footer', [ $this, 'wp_footer' ] );
@@ -200,20 +188,8 @@
200 188 return true;
201 189 }
202 190
203 191 /**
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();
213 - }
214 -
215 - /**
216 192 * Builder wrapper.
217 193 *
218 194 * Used to add an empty HTML wrapper for the builder, the javascript will add
219 195 * the content later.
@@ -252,13 +228,11 @@
252 228 wp_add_inline_script( 'jquery-migrate', 'jQuery.holdReady( true );' );
253 229
254 230 Plugin::$instance->frontend->enqueue_styles();
255 231
256 - Plugin::$instance->elements_manager->enqueue_elements_styles();
257 -
258 232 Plugin::$instance->widgets_manager->enqueue_widgets_styles();
259 233
260 - $suffix = Utils::is_script_debug() ? '' : '.min';
234 + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
261 235
262 236 $direction_suffix = is_rtl() ? '-rtl' : '';
263 237
264 238 wp_register_style(
@@ -276,17 +250,21 @@
276 250 ],
277 251 ELEMENTOR_VERSION
278 252 );
279 253
280 - wp_enqueue_style(
281 - 'e-theme-ui-light',
282 - $this->get_css_assets_url( 'theme-light' ),
283 - [],
284 - ELEMENTOR_VERSION
285 - );
254 + wp_enqueue_style( 'editor-preview' );
286 255
287 - wp_enqueue_style( 'editor-preview' );
256 + if ( ! Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ) ) {
257 + wp_register_style(
258 + 'editor-preview-legacy',
259 + ELEMENTOR_ASSETS_URL . 'css/editor-preview-legacy' . $direction_suffix . $suffix . '.css',
260 + [],
261 + ELEMENTOR_VERSION
262 + );
288 263
264 + wp_enqueue_style( 'editor-preview-legacy' );
265 + }
266 +
289 267 // Handle the 'wp audio' in editor preview.
290 268 wp_enqueue_style( 'wp-mediaelement' );
291 269
292 270 /**
@@ -312,11 +290,10 @@
312 290 private function enqueue_scripts() {
313 291 Plugin::$instance->frontend->register_scripts();
314 292
315 293 Plugin::$instance->widgets_manager->enqueue_widgets_scripts();
316 - Plugin::$instance->elements_manager->enqueue_elements_scripts();
317 294
318 - $suffix = Utils::is_script_debug() ? '' : '.min';
295 + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
319 296
320 297 wp_enqueue_script(
321 298 'elementor-inline-editor',
322 299 ELEMENTOR_ASSETS_URL . 'lib/inline-editor/js/inline-editor' . $suffix . '.js',