Skip to content

Commit

Permalink
fix: load styles
Browse files Browse the repository at this point in the history
  • Loading branch information
drill-lancer committed Sep 30, 2024
1 parent 4687ce4 commit 15cda6b
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ e.g.
1. VK Blocks examples.

== Changelog ==

[ Bug fix ] Fix load styles when separate load is enable.
[ Bug fix ][ Tab (Pro) ] Added a process to dynamically calculate and set the iframe height when the tab becomes active.
[ Bug Fix ] Fixed an issue where disabling separated loading caused all block CSS to load.
[ Add function ] [ Fixed Display (Pro) ] Added an option for "Fixed display from the bottom."
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/_pro/accordion/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"category": "vk-blocks-cat",
"editorScript": "vk-blocks-build-js",
"editorStyle": "vk-blocks-build-editor-css",
"style": "vk-blocks/accordion",
"style": "vk-blocks-build-css",
"attributes": {
"containerClass": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/_pro/animation/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"title": "Animation",
"editorScript": "vk-blocks-build-js",
"editorStyle": "vk-blocks-build-editor-css",
"style": "vk-blocks/animation",
"style": "vk-blocks-build-css",
"attributes": {
"effect": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/_pro/fixed-display/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"title": "Fixed display",
"editorScript": "vk-blocks-build-js",
"editorStyle": "vk-blocks-build-editor-css",
"style": "vk-blocks/fixed-display",
"style": "vk-blocks-build-css",
"attributes": {
"mode": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/_pro/tab/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"category": "vk-blocks-cat",
"editorScript": "vk-blocks-build-js",
"editorStyle": "vk-blocks-build-editor-css",
"style": "vk-blocks/tab",
"style": "vk-blocks-build-css",
"attributes": {
"tabOptionJSON": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/_pro/table-of-contents-new/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"category": "vk-blocks-cat",
"editorScript": "vk-blocks-build-js",
"editorStyle": "vk-blocks-build-editor-css",
"style": "vk-blocks/table-of-contents-new",
"style": "vk-blocks-build-css",
"attributes": {
"style": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/faq/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"textdomain": "vk-blocks-pro",
"editorScript": "vk-blocks-build-js",
"editorStyle": "vk-blocks-build-editor-css",
"style": "vk-blocks/faq",
"style": "vk-blocks-build-css",
"attributes": {
"heading": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/faq2/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"editorScript": "vk-blocks-build-js",
"editorStyle": "vk-blocks-build-editor-css",
"style": "vk-blocks/faq",
"style": "vk-blocks-build-css",
"attributes": {
"showContent": {
"type": "string",
Expand Down
3 changes: 3 additions & 0 deletions src/blocks/slider/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"description": "This slider allows you to place various items.Slider is do not move in edit screen.",
"textdomain": "vk-blocks-pro",
"category": "vk-blocks-cat-layout",
"editorScript": "vk-blocks-build-js",
"editorStyle": ["vk-swiper-style", "vk-blocks-build-editor-css"],
"style": "vk-blocks-build-css",
"attributes": {
"editorMode": {
"type": "string",
Expand Down
18 changes: 14 additions & 4 deletions src/blocks/slider/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,24 @@ function vk_blocks_register_block_slider() {
true
);

register_block_type(
__DIR__,
array(
// クラシックテーマ & 6.5 環境で $assets = array() のように空にしないと重複登録になるため
// ここで初期化しておく
$assets = array();
// Attend to load separate assets.
// 分割読み込みが有効な場合のみ、分割読み込み用のスクリプトを登録する
if ( method_exists( 'VK_Blocks_Block_Loader', 'should_load_separate_assets' ) && VK_Blocks_Block_Loader::should_load_separate_assets() ) {
$assets = array(
'style_handles' => array( 'vk-blocks/slider' ),
'script_handles' => array(),
'editor_style_handles' => array( 'vk-swiper-style', 'vk-blocks-build-editor-css' ),
'editor_script_handles' => array( 'vk-blocks-build-js' ),
)
);
}

register_block_type(
__DIR__,
$assets
);

}
add_action( 'init', 'vk_blocks_register_block_slider', 99 );

0 comments on commit 15cda6b

Please sign in to comment.