Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ 固定表示 ] JavaScript のファイルが二重に読み込まれていたため対応 #2099

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ e.g.

== Changelog ==

[ Bug fix ][ Fixed Display (Pro) ] Fixed an issue with redundant JavaScript loading in the WordPress 6.5 environment.
[ Add function ][ Tab (Pro) ] Add settings for when there are many labels or the screen width is narrow.
[ Bug fix ] Fixed an error in the component link toolbar in WordPress version 6.6.
[ Fix ][ Table of Contents (Pro) ] Improved pseudo elements for frontend page accessibility.
Expand Down
3 changes: 3 additions & 0 deletions src/blocks/_pro/fixed-display/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"name": "vk-blocks/fixed-display",
"category": "vk-blocks-cat",
"title": "Fixed display",
"editorScript": "vk-blocks-build-js",
"editorStyle": "vk-blocks-build-editor-css",
"style": "vk-blocks/fixed-display",
"attributes": {
"mode": {
"type": "string",
Expand Down
17 changes: 13 additions & 4 deletions src/blocks/_pro/fixed-display/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,23 @@ function vk_blocks_register_block_fixed_display() {
);
}

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' => 'vk-blocks/fixed-display',
'script' => 'vk-blocks/fixed-display-script',
'editor_style' => 'vk-blocks-build-editor-css',
'editor_script' => 'vk-blocks-build-js',
)
);
}

register_block_type(
__DIR__,
$assets
);
}
add_action( 'init', 'vk_blocks_register_block_fixed_display', 99 );
Loading