| @@ -38,10 +38,8 @@ | ||
| 38 | 38 | 'e-admin-notifications', |
| 39 | 39 | 'elementorNotifications', |
| 40 | 40 | $this->get_app_js_config() |
| 41 | 41 | ); |
| 42 | - | |
| 43 | - wp_set_script_translations( 'e-editor-notifications', 'elementor' ); | |
| 44 | 42 | }, 5 /* Before Elementor's admin enqueue scripts */ ); |
| 45 | 43 | |
| 46 | 44 | add_action( 'elementor/editor/v2/scripts/enqueue', [ $this, 'enqueue_editor_scripts' ] ); |
| 47 | 45 | add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_editor_scripts' ] ); |
| @@ -54,12 +52,17 @@ | ||
| 54 | 52 | 'elementor-editor', |
| 55 | 53 | 'elementor-v2-ui', |
| 56 | 54 | 'elementor-v2-icons', |
| 57 | 55 | 'elementor-v2-query', |
| 58 | - 'elementor-v2-editor-app-bar', | |
| 59 | 56 | 'wp-i18n', |
| 60 | 57 | ]; |
| 61 | 58 | |
| 59 | + $is_editor_v2 = current_action() === 'elementor/editor/v2/scripts/enqueue'; | |
| 60 | + | |
| 61 | + if ( $is_editor_v2 ) { | |
| 62 | + $deps[] = 'elementor-v2-editor-app-bar'; | |
| 63 | + } | |
| 64 | + | |
| 62 | 65 | wp_enqueue_script( |
| 63 | 66 | 'e-editor-notifications', |
| 64 | 67 | $this->get_js_assets_url( 'editor-notifications' ), |
| 65 | 68 | $deps, |
| @@ -71,13 +74,11 @@ | ||
| 71 | 74 | 'e-editor-notifications', |
| 72 | 75 | 'elementorNotifications', |
| 73 | 76 | $this->get_app_js_config() |
| 74 | 77 | ); |
| 75 | - | |
| 76 | - wp_set_script_translations( 'e-editor-notifications', 'elementor' ); | |
| 77 | 78 | } |
| 78 | 79 | |
| 79 | - private function get_app_js_config(): array { | |
| 80 | + private function get_app_js_config() : array { | |
| 80 | 81 | return [ |
| 81 | 82 | 'is_unread' => Options::has_unread_notifications(), |
| 82 | 83 | ]; |
| 83 | 84 | } |