diff --git a/includes/blocks/block-editor/tabs-item/block.json b/includes/blocks/block-editor/tabs-item/block.json index cfcddeb..d48eaa8 100644 --- a/includes/blocks/block-editor/tabs-item/block.json +++ b/includes/blocks/block-editor/tabs-item/block.json @@ -9,6 +9,5 @@ "reusable": false, "html": false }, - "parent":[ "tenup/tabs" ], - "editorScript": "file:../../../../dist/blocks/tabs-item-block.js" + "parent":[ "tenup/tabs" ] } diff --git a/includes/blocks/block-editor/tabs-item/register.php b/includes/blocks/block-editor/tabs-item/register.php index 6146494..33eea01 100644 --- a/includes/blocks/block-editor/tabs-item/register.php +++ b/includes/blocks/block-editor/tabs-item/register.php @@ -23,6 +23,24 @@ function register() { ] ); } + + // Enqueue assets. + add_action( 'enqueue_block_assets', $n( 'enqueue_block_assets' ) ); +} + +/** + * Enqueue block assets. + */ +function enqueue_block_assets() { + $asset_file = include PUBLISHER_MEDIA_KIT_PATH . 'dist/blocks/tabs-item-block.asset.php'; + + wp_enqueue_script( + 'publisher-media-kit-tabs-item-block', + PUBLISHER_MEDIA_KIT_URL . '/dist/blocks/tabs-item-block.js', + $asset_file['dependencies'], + $asset_file['version'], + true + ); } /** diff --git a/includes/blocks/block-editor/tabs/block.json b/includes/blocks/block-editor/tabs/block.json index dbe48e7..d896983 100644 --- a/includes/blocks/block-editor/tabs/block.json +++ b/includes/blocks/block-editor/tabs/block.json @@ -49,8 +49,5 @@ }, "supports": { "html": false - }, - "editorScript": "file:../../../../dist/blocks/tabs-block.js", - "editorStyle": "file:../../../../dist/blocks/tabs-block.css", - "style": "file:../../../../dist/blocks/tabs-block.css" + } } diff --git a/includes/blocks/block-editor/tabs/register.php b/includes/blocks/block-editor/tabs/register.php index 4976aba..0e0dd61 100644 --- a/includes/blocks/block-editor/tabs/register.php +++ b/includes/blocks/block-editor/tabs/register.php @@ -23,6 +23,31 @@ function register() { ] ); } + + // Enqueue assets. + add_action( 'enqueue_block_assets', $n( 'enqueue_block_assets' ) ); +} + +/** + * Enqueue block assets. + */ +function enqueue_block_assets() { + $asset_file = include PUBLISHER_MEDIA_KIT_PATH . 'dist/blocks/tabs-block.asset.php'; + + wp_enqueue_script( + 'publisher-media-kit-tabs-block', + PUBLISHER_MEDIA_KIT_URL . '/dist/blocks/tabs-block.js', + $asset_file['dependencies'], + $asset_file['version'], + true + ); + + wp_enqueue_style( + 'publisher-media-kit-tabs-block', + PUBLISHER_MEDIA_KIT_URL . '/dist/blocks/tabs-block.css', + [], + $asset_file['version'] + ); } /**