| @@ -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' ] ); |
| @@ -194,20 +189,8 @@ | ||
| 194 | 189 | return true; |
| 195 | 190 | } |
| 196 | 191 | |
| 197 | 192 | /** |
| 198 | - * Whether WordPress post preview or Elementor preview iframe is active. | |
| 199 | - * | |
| 200 | - * @since 4.1.0 | |
| 201 | - * @access public | |
| 202 | - * | |
| 203 | - * @return bool | |
| 204 | - */ | |
| 205 | - public function is_editor_or_preview() { | |
| 206 | - return is_preview() || $this->is_preview_mode(); | |
| 207 | - } | |
| 208 | - | |
| 209 | - /** | |
| 210 | 193 | * Builder wrapper. |
| 211 | 194 | * |
| 212 | 195 | * Used to add an empty HTML wrapper for the builder, the javascript will add |
| 213 | 196 | * the content later. |
| @@ -246,13 +229,11 @@ | ||
| 246 | 229 | wp_add_inline_script( 'jquery-migrate', 'jQuery.holdReady( true );' ); |
| 247 | 230 | |
| 248 | 231 | Plugin::$instance->frontend->enqueue_styles(); |
| 249 | 232 | |
| 250 | - Plugin::$instance->elements_manager->enqueue_elements_styles(); | |
| 251 | - | |
| 252 | 233 | Plugin::$instance->widgets_manager->enqueue_widgets_styles(); |
| 253 | 234 | |
| 254 | - $suffix = Utils::is_script_debug() ? '' : '.min'; | |
| 235 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 255 | 236 | |
| 256 | 237 | $direction_suffix = is_rtl() ? '-rtl' : ''; |
| 257 | 238 | |
| 258 | 239 | wp_register_style( |
| @@ -279,8 +260,19 @@ | ||
| 279 | 260 | ); |
| 280 | 261 | |
| 281 | 262 | wp_enqueue_style( 'editor-preview' ); |
| 282 | 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 | + | |
| 283 | 275 | // Handle the 'wp audio' in editor preview. |
| 284 | 276 | wp_enqueue_style( 'wp-mediaelement' ); |
| 285 | 277 | |
| 286 | 278 | /** |
| @@ -306,11 +298,10 @@ | ||
| 306 | 298 | private function enqueue_scripts() { |
| 307 | 299 | Plugin::$instance->frontend->register_scripts(); |
| 308 | 300 | |
| 309 | 301 | Plugin::$instance->widgets_manager->enqueue_widgets_scripts(); |
| 310 | - Plugin::$instance->elements_manager->enqueue_elements_scripts(); | |
| 311 | 302 | |
| 312 | - $suffix = Utils::is_script_debug() ? '' : '.min'; | |
| 303 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 313 | 304 | |
| 314 | 305 | wp_enqueue_script( |
| 315 | 306 | 'elementor-inline-editor', |
| 316 | 307 | ELEMENTOR_ASSETS_URL . 'lib/inline-editor/js/inline-editor' . $suffix . '.js', |