Skip to content

Commit

Permalink
Merge pull request #2099 from vektor-inc/fix/fixed-display/double-loa…
Browse files Browse the repository at this point in the history
…ding

【二人目確認中】[ 固定表示 ] JavaScript のファイルが二重に読み込まれていたため対応
  • Loading branch information
sysbird authored Jul 10, 2024
2 parents 92b7fd8 + c30604a commit ba16668
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
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 );

0 comments on commit ba16668

Please sign in to comment.