| @@ -37,8 +37,9 @@ | ||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function init_hooks() { |
| 40 | 40 | add_filter( 'jet-form-builder/blocks/items', array( $this, 'add_blocks_types' ) ); |
| 41 | + add_action( 'init', array( $this, 'register_editor_styles' ) ); | |
| 41 | 42 | add_action( 'jet-form-builder/editor-assets/before', array( $this, 'enqueue_admin_assets' ) ); |
| 42 | 43 | add_action( 'wp_enqueue_scripts', array( $this, 'register_frontend_scripts' ) ); |
| 43 | 44 | add_action( 'jet_plugins/frontend/register_scripts', array( $this, 'register_frontend_scripts' ) ); |
| 44 | 45 | } |
| @@ -44,8 +45,9 @@ | ||
| 44 | 45 | } |
| 45 | 46 | |
| 46 | 47 | public function remove_hooks() { |
| 47 | 48 | remove_filter( 'jet-form-builder/blocks/items', array( $this, 'add_blocks_types' ) ); |
| 49 | + remove_action( 'init', array( $this, 'register_editor_styles' ) ); | |
| 48 | 50 | remove_action( 'jet-form-builder/editor-assets/before', array( $this, 'enqueue_admin_assets' ) ); |
| 49 | 51 | remove_action( 'wp_enqueue_scripts', array( $this, 'register_frontend_scripts' ) ); |
| 50 | 52 | remove_action( 'jet_plugins/frontend/register_scripts', array( $this, 'register_frontend_scripts' ) ); |
| 51 | 53 | } |
| @@ -55,38 +57,41 @@ | ||
| 55 | 57 | |
| 56 | 58 | return $block_types; |
| 57 | 59 | } |
| 58 | 60 | |
| 59 | - public function enqueue_admin_assets() { | |
| 60 | - $script_asset = require_once $this->get_dir( 'assets/build/editor.asset.php' ); | |
| 61 | + public function register_editor_styles() { | |
| 61 | 62 | |
| 62 | - wp_enqueue_script( | |
| 63 | - $this->get_handle(), | |
| 64 | - $this->get_url( 'assets/build/editor.js' ), | |
| 65 | - $script_asset['dependencies'], | |
| 66 | - $script_asset['version'], | |
| 67 | - true | |
| 68 | - ); | |
| 69 | - | |
| 70 | - wp_enqueue_style( | |
| 63 | + $editor_asset = require $this->get_dir( 'assets/build/editor.asset.php' ); | |
| 64 | + wp_register_style( | |
| 71 | 65 | $this->get_handle( 'lightgray-skin' ), |
| 72 | 66 | includes_url( 'js/tinymce/skins/lightgray/skin.min.css' ), |
| 73 | 67 | array(), |
| 74 | - $script_asset['version'] | |
| 68 | + $editor_asset['version'] | |
| 75 | 69 | ); |
| 76 | - | |
| 77 | - wp_enqueue_style( | |
| 70 | + wp_register_style( | |
| 78 | 71 | $this->get_handle(), |
| 79 | 72 | $this->get_url( 'assets/build/wysiwyg.css' ), |
| 80 | 73 | array( |
| 81 | 74 | 'editor-buttons', |
| 82 | 75 | ), |
| 83 | - $script_asset['version'] | |
| 76 | + $editor_asset['version'] | |
| 84 | 77 | ); |
| 85 | 78 | } |
| 86 | 79 | |
| 80 | + public function enqueue_admin_assets() { | |
| 81 | + $script_asset = require $this->get_dir( 'assets/build/editor.asset.php' ); | |
| 82 | + | |
| 83 | + wp_enqueue_script( | |
| 84 | + $this->get_handle(), | |
| 85 | + $this->get_url( 'assets/build/editor.js' ), | |
| 86 | + $script_asset['dependencies'], | |
| 87 | + $script_asset['version'], | |
| 88 | + true | |
| 89 | + ); | |
| 90 | + } | |
| 91 | + | |
| 87 | 92 | public function register_frontend_scripts() { |
| 88 | - $script_asset = require_once $this->get_dir( 'assets/build/wysiwyg.asset.php' ); | |
| 93 | + $script_asset = require $this->get_dir( 'assets/build/wysiwyg.asset.php' ); | |
| 89 | 94 | |
| 90 | 95 | if ( true === $script_asset ) { |
| 91 | 96 | return; |
| 92 | 97 | } |