Fix asset importing
This commit is contained in:
parent
b142f57648
commit
ff1f452e61
|
@ -79,16 +79,14 @@ if ( !class_exists('CognitoFormsPlugin') ) {
|
|||
|
||||
// Initialize block
|
||||
public function block_init() {
|
||||
$dir = dirname( __FILE__ );
|
||||
|
||||
$asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/index.asset.php');
|
||||
|
||||
// Register global block styles
|
||||
wp_register_style(
|
||||
'cognito-block-global-css', // Handle.
|
||||
plugins_url( 'dist/style.css', __FILE__ ),
|
||||
plugins_url( 'dist/style-main.css', __FILE__ ), // Public CSS
|
||||
is_admin() ? array( 'wp-editor' ) : null, // Dependency to include the CSS after it.
|
||||
null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
|
||||
$asset_file['version']
|
||||
);
|
||||
|
||||
// Register block editor script for backend
|
||||
|
@ -104,7 +102,7 @@ if ( !class_exists('CognitoFormsPlugin') ) {
|
|||
'cognito-block-editor-css', // Handle.
|
||||
plugins_url( 'dist/main.css', __FILE__ ), // Block editor CSS.
|
||||
array( 'wp-edit-blocks' ), // Dependency to include the CSS after it.
|
||||
null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: File modification time.
|
||||
$asset_file['version']
|
||||
);
|
||||
|
||||
register_block_type(
|
||||
|
@ -115,7 +113,8 @@ if ( !class_exists('CognitoFormsPlugin') ) {
|
|||
'editor_script' => 'cognito-block-editor-js',
|
||||
// Enqueue editor block styles in the editor only
|
||||
'editor_style' => 'cognito-block-editor-css'
|
||||
) );
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Initialize classic editor (TinyMCE)
|
||||
|
|
Loading…
Reference in New Issue