| @@ -52,8 +52,9 @@ | ||
| 52 | 52 | public function __construct( Visualizer_Plugin $plugin ) { |
| 53 | 53 | parent::__construct( $plugin ); |
| 54 | 54 | $this->_addAction( 'load-post.php', 'enqueueMediaScripts' ); |
| 55 | 55 | $this->_addAction( 'load-post-new.php', 'enqueueMediaScripts' ); |
| 56 | + $this->_addAction( 'enqueue_block_editor_assets', 'enqueueMediaScripts' ); | |
| 56 | 57 | $this->_addAction( 'admin_footer', 'renderTemplates' ); |
| 57 | 58 | $this->_addAction( 'admin_enqueue_scripts', 'enqueueLibraryScripts', null, 0 ); |
| 58 | 59 | $this->_addAction( 'admin_menu', 'registerAdminMenu' ); |
| 59 | 60 | $this->_addFilter( 'media_view_strings', 'setupMediaViewStrings' ); |
| @@ -329,9 +330,11 @@ | ||
| 329 | 330 | * @access public |
| 330 | 331 | */ |
| 331 | 332 | public function enqueueMediaScripts() { |
| 332 | 333 | global $typenow; |
| 333 | - if ( post_type_supports( $typenow, 'editor' ) ) { | |
| 334 | + global $current_screen; | |
| 335 | + | |
| 336 | + if ( post_type_supports( $typenow, 'editor' ) || $current_screen->id === 'widgets' ) { | |
| 334 | 337 | wp_enqueue_style( 'visualizer-media', VISUALIZER_ABSURL . 'css/media.css', array( 'media-views' ), Visualizer_Plugin::VERSION ); |
| 335 | 338 | |
| 336 | 339 | // Load all the assets for the different libraries we support. |
| 337 | 340 | $deps = array( |
| @@ -1018,8 +1021,9 @@ | ||
| 1018 | 1021 | ); |
| 1019 | 1022 | } |
| 1020 | 1023 | // enqueue charts array |
| 1021 | 1024 | $ajaxurl = admin_url( 'admin-ajax.php' ); |
| 1025 | + | |
| 1022 | 1026 | wp_localize_script( |
| 1023 | 1027 | 'visualizer-library', |
| 1024 | 1028 | 'visualizer', |
| 1025 | 1029 | array( |