Media && window.matchMedia( `(prefers-color-scheme: dark)` ).matches ) { document.body.classList.add( `eps-theme-dark` ); }' ); } } private function enqueue_assets() { Plugin::$instance->init_common(); /** @var WebCLIModule $web_cli */ $web_cli = Plugin::$instance->modules_manager->get_modules( 'web-cli' ); $web_cli->register_scripts(); Plugin::$instance->common->register_scripts(); wp_register_style( 'select2', $this->get_css_assets_url( 'e-select2', 'assets/lib/e-select2/css/' ), [], '4.0.6-rc.1' ); Plugin::$instance->common->register_styles(); wp_register_style( 'select2', ELEMENTOR_ASSETS_URL . 'lib/e-select2/css/e-select2.css', [], '4.0.6-rc.1' ); wp_enqueue_style( 'elementor-app', $this->get_css_assets_url( 'app', null, 'default', true ), [ 'select2', 'elementor-icons', 'elementor-common', 'select2', ], ELEMENTOR_VERSION ); wp_enqueue_script( 'elementor-app-packages', $this->get_js_assets_url( 'app-packages' ), [ 'wp-i18n', 'react', ], ELEMENTOR_VERSION, true ); wp_register_script( 'select2', $this->get_js_assets_url( 'e-select2.full', 'assets/lib/e-select2/js/' ), [ 'jquery', ], '4.0.6-rc.1', true ); wp_enqueue_script( 'elementor-app', $this->get_js_assets_url( 'app' ), [ 'wp-url', 'wp-i18n', 'react', 'react-dom', 'select2', ], ELEMENTOR_VERSION, true ); $this->enqueue_dark_theme_detection_script(); wp_set_script_translations( 'elementor-app-packages', 'elementor' ); wp_set_script_translations( 'elementor-app', 'elementor' ); $this->print_config(); } public function enqueue_app_loader() { wp_enqueue_script( 'elementor-app-loader', $this->get_js_assets_url( 'app-loader' ), [ 'elementor-common', ], ELEMENTOR_VERSION, true ); $this->print_config( 'elementor-app-loader' ); } public function __construct() { $this->add_component( 'site-editor', new Modules\SiteEditor\Module() ); if ( current_user_can( 'manage_options' ) || Utils::is_wp_cli() ) { $this->add_component( 'import-export', new Modules\ImportExport\Module() ); // Kit library is depended on import-export $this->add_component( 'kit-library', new Modules\KitLibrary\Module() ); } $this->add_component( 'onboarding', new Modules\Onboarding\Module() ); add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu ) { $this->register_admin_menu( $admin_menu ); }, Source_Local::ADMIN_MENU_PRIORITY + 10 ); // Happens after WP plugin page validation. add_filter( 'add_menu_classes', [ $this, 'fix_submenu' ] ); if ( $this->is_current() ) { add_action( 'admin_init', [ $this, 'admin_init' ], 0 ); } else { add_action( 'elementor/common/after_register_scripts', [ $this, 'enqueue_app_loader' ] ); } } }