| @@ -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( |
| @@ -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', |