| @@ -1,9 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | 4 | use Elementor\Core\Base\App; |
| 5 | -use Elementor\Core\Settings\Manager as SettingsManager; | |
| 6 | 5 | |
| 7 | 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | 7 | exit; // Exit if accessed directly. |
| 9 | 8 | } |
| @@ -18,13 +17,8 @@ | ||
| 18 | 17 | */ |
| 19 | 18 | class Preview extends App { |
| 20 | 19 | |
| 21 | 20 | /** |
| 22 | - * The priority of the preview enqueued styles. | |
| 23 | - */ | |
| 24 | - const ENQUEUED_STYLES_PRIORITY = 20; | |
| 25 | - | |
| 26 | - /** | |
| 27 | 21 | * Is Preview. |
| 28 | 22 | * |
| 29 | 23 | * Holds a flag if current request is a preview. |
| 30 | 24 | * The flag is not related to a specific post or edit permissions. |
| @@ -83,9 +77,9 @@ | ||
| 83 | 77 | register_shutdown_function( function () { |
| 84 | 78 | $e = error_get_last(); |
| 85 | 79 | if ( $e ) { |
| 86 | 80 | echo '<div id="elementor-preview-debug-error"><pre>'; |
| 87 | - Utils::print_unescaped_internal_string( $e['message'] ); | |
| 81 | + echo $e['message']; | |
| 88 | 82 | echo '</pre></div>'; |
| 89 | 83 | } |
| 90 | 84 | } ); |
| 91 | 85 | } |
| @@ -107,9 +101,9 @@ | ||
| 107 | 101 | |
| 108 | 102 | add_action( 'wp_enqueue_scripts', function() { |
| 109 | 103 | $this->enqueue_styles(); |
| 110 | 104 | $this->enqueue_scripts(); |
| 111 | - }, self::ENQUEUED_STYLES_PRIORITY ); | |
| 105 | + } ); | |
| 112 | 106 | |
| 113 | 107 | add_filter( 'the_content', [ $this, 'builder_wrapper' ], 999999 ); |
| 114 | 108 | |
| 115 | 109 | add_action( 'wp_footer', [ $this, 'wp_footer' ] ); |
| @@ -194,20 +188,8 @@ | ||
| 194 | 188 | return true; |
| 195 | 189 | } |
| 196 | 190 | |
| 197 | 191 | /** |
| 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 | 192 | * Builder wrapper. |
| 211 | 193 | * |
| 212 | 194 | * Used to add an empty HTML wrapper for the builder, the javascript will add |
| 213 | 195 | * the content later. |
| @@ -246,13 +228,11 @@ | ||
| 246 | 228 | wp_add_inline_script( 'jquery-migrate', 'jQuery.holdReady( true );' ); |
| 247 | 229 | |
| 248 | 230 | Plugin::$instance->frontend->enqueue_styles(); |
| 249 | 231 | |
| 250 | - Plugin::$instance->elements_manager->enqueue_elements_styles(); | |
| 251 | - | |
| 252 | 232 | Plugin::$instance->widgets_manager->enqueue_widgets_styles(); |
| 253 | 233 | |
| 254 | - $suffix = Utils::is_script_debug() ? '' : '.min'; | |
| 234 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 255 | 235 | |
| 256 | 236 | $direction_suffix = is_rtl() ? '-rtl' : ''; |
| 257 | 237 | |
| 258 | 238 | wp_register_style( |
| @@ -270,19 +250,20 @@ | ||
| 270 | 250 | ], |
| 271 | 251 | ELEMENTOR_VERSION |
| 272 | 252 | ); |
| 273 | 253 | |
| 274 | - wp_enqueue_style( | |
| 275 | - 'e-theme-ui-light', | |
| 276 | - $this->get_css_assets_url( 'theme-light' ), | |
| 277 | - [], | |
| 278 | - ELEMENTOR_VERSION | |
| 279 | - ); | |
| 254 | + wp_enqueue_style( 'editor-preview' ); | |
| 280 | 255 | |
| 281 | - 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 | + ); | |
| 282 | 263 | |
| 283 | - // Handle the 'wp audio' in editor preview. | |
| 284 | - wp_enqueue_style( 'wp-mediaelement' ); | |
| 264 | + wp_enqueue_style( 'editor-preview-legacy' ); | |
| 265 | + } | |
| 285 | 266 | |
| 286 | 267 | /** |
| 287 | 268 | * Preview enqueue styles. |
| 288 | 269 | * |
| @@ -306,11 +287,10 @@ | ||
| 306 | 287 | private function enqueue_scripts() { |
| 307 | 288 | Plugin::$instance->frontend->register_scripts(); |
| 308 | 289 | |
| 309 | 290 | Plugin::$instance->widgets_manager->enqueue_widgets_scripts(); |
| 310 | - Plugin::$instance->elements_manager->enqueue_elements_scripts(); | |
| 311 | 291 | |
| 312 | - $suffix = Utils::is_script_debug() ? '' : '.min'; | |
| 292 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| 313 | 293 | |
| 314 | 294 | wp_enqueue_script( |
| 315 | 295 | 'elementor-inline-editor', |
| 316 | 296 | ELEMENTOR_ASSETS_URL . 'lib/inline-editor/js/inline-editor' . $suffix . '.js', |
| @@ -317,11 +297,8 @@ | ||
| 317 | 297 | [], |
| 318 | 298 | ELEMENTOR_VERSION, |
| 319 | 299 | true |
| 320 | 300 | ); |
| 321 | - | |
| 322 | - // Handle the 'wp audio' in editor preview. | |
| 323 | - wp_enqueue_script( 'wp-mediaelement' ); | |
| 324 | 301 | |
| 325 | 302 | /** |
| 326 | 303 | * Preview enqueue scripts. |
| 327 | 304 | * |