| @@ -18,13 +18,8 @@ | ||
| 18 | 18 | */ |
| 19 | 19 | class Preview extends App { |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * The priority of the preview enqueued styles. | |
| 23 | - */ | |
| 24 | - const ENQUEUED_STYLES_PRIORITY = 20; | |
| 25 | - | |
| 26 | - /** | |
| 27 | 22 | * Is Preview. |
| 28 | 23 | * |
| 29 | 24 | * Holds a flag if current request is a preview. |
| 30 | 25 | * The flag is not related to a specific post or edit permissions. |
| @@ -107,9 +102,9 @@ | ||
| 107 | 102 | |
| 108 | 103 | add_action( 'wp_enqueue_scripts', function() { |
| 109 | 104 | $this->enqueue_styles(); |
| 110 | 105 | $this->enqueue_scripts(); |
| 111 | - }, self::ENQUEUED_STYLES_PRIORITY ); | |
| 106 | + } ); | |
| 112 | 107 | |
| 113 | 108 | add_filter( 'the_content', [ $this, 'builder_wrapper' ], 999999 ); |
| 114 | 109 | |
| 115 | 110 | add_action( 'wp_footer', [ $this, 'wp_footer' ] ); |
| @@ -234,13 +229,11 @@ | ||
| 234 | 229 | wp_add_inline_script( 'jquery-migrate', 'jQuery.holdReady( true );' ); |
| 235 | 230 | |
| 236 | 231 | Plugin::$instance->frontend->enqueue_styles(); |
| 237 | 232 | |
| 238 | - Plugin::$instance->elements_manager->enqueue_elements_styles(); | |
| 239 | - | |
| 240 | 233 | Plugin::$instance->widgets_manager->enqueue_widgets_styles(); |
| 241 | 234 | |
| 242 | - $suffix = Utils::is_script_debug() ? '' : '.min'; | |
| 235 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 243 | 236 | |
| 244 | 237 | $direction_suffix = is_rtl() ? '-rtl' : ''; |
| 245 | 238 | |
| 246 | 239 | wp_register_style( |
| @@ -267,8 +260,19 @@ | ||
| 267 | 260 | ); |
| 268 | 261 | |
| 269 | 262 | wp_enqueue_style( 'editor-preview' ); |
| 270 | 263 | |
| 264 | + if ( ! Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ) ) { | |
| 265 | + wp_register_style( | |
| 266 | + 'editor-preview-legacy', | |
| 267 | + ELEMENTOR_ASSETS_URL . 'css/editor-preview-legacy' . $direction_suffix . $suffix . '.css', | |
| 268 | + [], | |
| 269 | + ELEMENTOR_VERSION | |
| 270 | + ); | |
| 271 | + | |
| 272 | + wp_enqueue_style( 'editor-preview-legacy' ); | |
| 273 | + } | |
| 274 | + | |
| 271 | 275 | // Handle the 'wp audio' in editor preview. |
| 272 | 276 | wp_enqueue_style( 'wp-mediaelement' ); |
| 273 | 277 | |
| 274 | 278 | /** |
| @@ -294,11 +298,10 @@ | ||
| 294 | 298 | private function enqueue_scripts() { |
| 295 | 299 | Plugin::$instance->frontend->register_scripts(); |
| 296 | 300 | |
| 297 | 301 | Plugin::$instance->widgets_manager->enqueue_widgets_scripts(); |
| 298 | - Plugin::$instance->elements_manager->enqueue_elements_scripts(); | |
| 299 | 302 | |
| 300 | - $suffix = Utils::is_script_debug() ? '' : '.min'; | |
| 303 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 301 | 304 | |
| 302 | 305 | wp_enqueue_script( |
| 303 | 306 | 'elementor-inline-editor', |
| 304 | 307 | ELEMENTOR_ASSETS_URL . 'lib/inline-editor/js/inline-editor' . $suffix . '.js', |