Skip to content

Commit

Permalink
Merge pull request #2456 from vektor-inc/develop
Browse files Browse the repository at this point in the history
[ Change version ] 1.96.0.0
  • Loading branch information
kurudrive authored Feb 19, 2025
2 parents ca20f17 + d07edf1 commit 8454579
Show file tree
Hide file tree
Showing 97 changed files with 7,175 additions and 7,832 deletions.
3 changes: 2 additions & 1 deletion editor-css/_editor_before_tab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
margin-bottom:0;
}
}
.block-list-appender{
// .vk_tab_bodys_body と隣接する .block-list-appender だけを対象にする
.vk_tab_bodys_body.block-editor-block-list__block + .block-list-appender {
position: absolute;
top: calc( 1rem * -6 );
right: calc( 1rem * 0 );
Expand Down
53 changes: 42 additions & 11 deletions inc/vk-blocks/load-vk-components.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,58 @@
use VektorInc\VK_Component\VK_Component_Posts;

/**
* Boostrapの読み込み
* VK Components(Bootstrap) を読み込むべきか判定
*
* @param string $hook_suffix hook suffix.
* @return bool 読み込む場合 true、読み込まない場合 false
*/
function vk_blocks_load_vk_components( $hook_suffix ) {
function vk_blocks_should_load_vk_components() {
$template = wp_get_theme()->Template;
// lightning 系(ベクトル)の場合 vk-components はテーマなどで読み込むので必要ない
if ( 'lightning' === $template || 'lightning-pro' === $template || 'katawara' === $template ) {
return;
}
// lightning 系(ベクトル)の場合 vk-components はテーマなどで読み込むので適用しない
$should_load = ! in_array( $template, array( 'lightning', 'lightning-pro', 'katawara' ), true );

return apply_filters( 'vk_blocks_should_load_vk_components', $should_load );
}

// 条件に合わなければここで return することで、以降の処理を実行しない
if ( ! vk_blocks_should_load_vk_components() ) {
return;
}

/**
* VK Components(Bootstrap) の登録 & 読み込み
*/
function vk_blocks_register_vk_components_style() {
VK_Component_Posts::register_style( 'vk-components-style' );
}
add_action( 'init', 'vk_blocks_register_vk_components_style' );

// 管理画面
/**
* VK Components(Bootstrap) を管理画面とフロントに適用
*
* @param string $hook_suffix hook suffix.
*/
function vk_blocks_enqueue_vk_components_style( $hook_suffix = '' ) {
if ( is_admin() ) {
if ( 'post.php' === $hook_suffix || 'post-new.php' === $hook_suffix ) {
if ( in_array( $hook_suffix, array( 'post.php', 'post-new.php' ), true ) ) {
wp_enqueue_style( 'vk-components-style' );
}
} else {
wp_enqueue_style( 'vk-components-style' );
}
}
add_action( 'admin_enqueue_scripts', 'vk_blocks_load_vk_components' );
add_action( 'wp_enqueue_scripts', 'vk_blocks_load_vk_components' );
add_action( 'admin_enqueue_scripts', 'vk_blocks_enqueue_vk_components_style' );
add_action( 'wp_enqueue_scripts', 'vk_blocks_enqueue_vk_components_style' );

/**
* エディター用の VK Components(Bootstrap) を適用
*/
function vk_blocks_enqueue_vk_components_editor_style() {
// スタイルが登録されていない場合は登録
if ( ! wp_style_is( 'vk-components-style', 'registered' ) ) {
VK_Component_Posts::register_style( 'vk-components-style' );
}

// スタイルを適用
wp_enqueue_style( 'vk-components-style' );
}
add_action( 'enqueue_block_assets', 'vk_blocks_enqueue_vk_components_editor_style' );
Loading

0 comments on commit 8454579

Please sign in to comment.