Skip to content

Commit

Permalink
Merge pull request #2026 from vektor-inc/develop
Browse files Browse the repository at this point in the history
[ Change version ] 1.74.0.0
  • Loading branch information
kurudrive authored Jun 4, 2024
2 parents 60433f8 + b381066 commit f1b579a
Show file tree
Hide file tree
Showing 18 changed files with 731 additions and 143 deletions.
15 changes: 8 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@

## どういう変更をしたか?

* このプルリクで変更した事を記載してください
<!-- [ このプルリクで変更した事を記載してください ] -->

### スクリーンショットまたは動画

#### 変更前 Before

#### 変更後 After

## 実装者の確認事項

Expand All @@ -23,23 +28,19 @@

## 変更内容について何を確認したか、どういう方法で確認をしたかなど

実装者が確認した手順を箇条書きで記載してください。
<!-- [ 実装者が確認した手順を箇条書きで記載してください。予備知識のないレビュワーが見て再現しやすい手順で記載してください。 ] -->

*
*
*

## 確認URL

( どこかのデモサイトかテストサーバーにデプロイ済みなどで確認できる場合はそのURL )

## レビュワーに回す前の確認事項

- [ ] 実装者はこのテンプレートのチェック項目をちゃんと確認してチェックしたか?

## レビュワー確認方法・確認内容など

レビュワーがどういう手順で何を確認して欲しいかを記載してください。
<!-- [ レビュワーがどういう手順で何を確認して欲しいかを記載してください。 ] -->

*
*
Expand Down
3 changes: 2 additions & 1 deletion editor-css/_editor_before.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
.editor-block-list-item-vk-blocks-grid-column:after,
.editor-block-list-item-vk-blocks-gridcolcard:after,
.editor-block-list-item-vk-blocks-icon-card:after,
.editor-block-list-item-vk-blocks-fixed-display:after {
.editor-block-list-item-vk-blocks-fixed-display:after,
.editor-block-list-item-vk-blocks-tab:after {
position: absolute;
top: 0;
right: 0;
Expand Down
32 changes: 20 additions & 12 deletions inc/vk-blocks/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,29 @@ function vk_blocks_blocks_categories( $categories ) {
$keys[] = $value['slug'];
}

if ( ! in_array( 'vk-blocks-cat', $keys, true ) ) {
if ( ! in_array( 'vk-blocks-cat-layout', $keys, true ) ) {
$categories = array_merge(
$categories,
array(
array(
'slug' => 'vk-blocks-cat',
'title' => $vk_blocks_prefix . __( 'Blocks', 'vk-blocks-pro' ),
'icon' => '',
'slug' => 'vk-blocks-cat-layout',
'title' => $vk_blocks_prefix . __( 'Blocks Layout', 'vk-blocks-pro' ),
'icon' => '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0V0z" /><path d="M19 13H5v-2h14v2z" /></svg>',
),
)
),
$categories
);
}

if ( ! in_array( 'vk-blocks-cat-layout', $keys, true ) ) {
if ( ! in_array( 'vk-blocks-cat', $keys, true ) ) {
$categories = array_merge(
$categories,
array(
array(
'slug' => 'vk-blocks-cat-layout',
'title' => $vk_blocks_prefix . __( 'Blocks Layout', 'vk-blocks-pro' ),
'slug' => 'vk-blocks-cat',
'title' => $vk_blocks_prefix . __( 'Blocks', 'vk-blocks-pro' ),
'icon' => '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="none" d="M0 0h24v24H0V0z" /><path d="M19 13H5v-2h14v2z" /></svg>',
),
)
),
$categories
);
}

Expand All @@ -58,7 +58,15 @@ function vk_blocks_blocks_categories( $categories ) {

return $categories;
}
add_filter( 'block_categories_all', 'vk_blocks_blocks_categories', 10, 2 );

/*
Priority
10 - Exunit
11 - Video Block
12 - VK Filter Search
13 - VK Blocks
*/
add_filter( 'block_categories_all', 'vk_blocks_blocks_categories', 13, 2 ); // ExUnit を 先に処理するために priority 11 に設定

/**
* VK Blocks Hide Blocks
Expand Down
14 changes: 10 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Contributors: vektor-inc,kurudrive,naoki0h,nc30,una9,kaorock72,rickaddison7634,mimitips,mthaichi,shimotomoki,sysbird,chiakikouno,doshimaf,mtdkei
Donate link:
Tags: Gutenberg,FAQ,alert
Requires at least: 6.2
Requires at least: 6.3
Tested up to: 6.5
Stable tag: 1.72.1.1
Stable tag: 1.73.0.1
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -103,11 +103,17 @@ e.g.

== Changelog ==

= 1.74.0 =
[ Specification Change ] Fix block categories order
[ Specification Change ][ VK Button ] Add unit "percent" for border radius.
[ Bug fix ][ Button ] Fixed button URL being output in editor.
[ Bug fix ][ Tab ] Fix innactive tab color setting.

= 1.73.0 =
[ Add Block ] Add Tab Block
[ Add function ][ Columns ] Add direction reverse option.
[ Add function ][ Button ] Add border radius setting.
[ Add Function ][ Spacer ][ Common margin ] Add size option XXL/XXS.
[ Add function ][ VK Button ] Add border radius setting.
[ Add Function ][ Spacer / Common margin ] Add size option XXL/XXS.
[ Add function ][ Grid Column Card (Pro) ] Add border width setting to grid column card block.
[ Add Function ][ Outer (Pro) ] Added option to min height setting.
[ Specification Change ][ Custom CSS (Pro) ] Changed the custom CSS text area to be wider
Expand Down
24 changes: 24 additions & 0 deletions src/block-category/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { updateCategory } from '@wordpress/blocks';

export const vkBlocksCategoryIcon = () => {
const blockCategoryIcon = (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
>
<path
fill="#000"
d="m19.84 6.586-4.751.011a.161.161 0 0 0-.15.11l-.363 1.05c-.032.111.043.222.15.222h1.847c.138 0 .213.176.117.276l-2.947 3.172h.011l1.516 4.94c.032.11-.043.21-.15.21h-1.483a.151.151 0 0 1-.15-.11l-.758-2.531c-.042-.155-.245-.155-.299-.012l-.619 1.78a.16.16 0 0 0 0 .1l.566 2.154c.021.067.085.122.15.122h4.782c.107 0 .182-.11.15-.21l-1.933-6.222c-.021-.056 0-.122.043-.166l4.388-4.62c.096-.1.021-.276-.118-.276Z"
/>
<path
fill="#D8141C"
d="m14.213 4-2.893.011a.161.161 0 0 0-.15.11l-.373 1.05a.163.163 0 0 0 .15.222h1.217c.106 0 .181.11.149.22l-3.448 9.77a.158.158 0 0 1-.3 0L6.09 8.333a.163.163 0 0 1 .15-.222h1.249c.064 0 .128.044.15.11l.896 2.543a.158.158 0 0 0 .299 0l1.388-3.957a.163.163 0 0 0-.15-.22H4.157c-.107 0-.182.11-.15.22l4.548 13.085a.158.158 0 0 0 .3 0l5.508-15.671c.032-.11-.043-.221-.15-.221Z"
/>
</svg>
);

updateCategory('vk-blocks-cat', { icon: blockCategoryIcon });
updateCategory('vk-blocks-cat-layout', { icon: blockCategoryIcon });
};
110 changes: 110 additions & 0 deletions src/blocks/_pro/tab/deprecated/1.73.0/save.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
import { isHexColor } from '@vkblocks/utils/is-hex-color';

export default function save(props) {
const { attributes } = props;
const {
tabOptionJSON,
tabSizeSp,
tabSizeTab,
tabSizePc,
firstActive,
blockId,
} = attributes;

const tabSizePrefix = 'vk_tab_labels-tabSize';

const tabSizes = [
{
name: 'sp',
attribute: tabSizeSp,
},
{
name: 'tab',
attribute: tabSizeTab,
},
{
name: 'pc',
attribute: tabSizePc,
},
];

let tabListClassName = `vk_tab_labels`;
tabSizes.forEach((tabSize) => {
if (tabSize.attribute !== null && tabSize.attribute !== undefined) {
tabListClassName += ` ${tabSizePrefix}--${tabSize.name}-${tabSize.attribute}`;
}
});

const tabOption = JSON.parse(tabOptionJSON);

let tabList = '';
let tabListInner = '';
if (
Object.keys(tabOption).length !== 0 &&
tabOption.listArray.length !== 0
) {
tabListInner = tabOption.listArray.map((option, index) => {
let activeLabelClass = '';
if (firstActive === index) {
activeLabelClass = ' vk_tab_labels_label-state-active';
}
let tabColorClass = '';
let tabColorStyle = {};
let tabSpanColorClass = '';
let tabSpanColorStyle = {};
if (option.tabColor !== '') {
if (tabOption.tabLabelBackground) {
tabColorClass = ' has-background';
if (!isHexColor(option.tabColor)) {
tabColorClass += ` has-${option.tabColor}-background-color`;
} else {
tabColorStyle = {
backgroundColor: option.tabColor,
};
}
} else if (tabOption.tabLabelBorderTop) {
tabSpanColorClass = ' has-border-top';
if (!isHexColor(option.tabColor)) {
tabSpanColorClass += ` has-${option.tabColor}-border-color`;
} else {
tabSpanColorStyle = {
borderTopColor: option.tabColor,
};
}
}
}

return (
<li
id={`vk_tab_labels_label-${option.blockId}`}
className={`vk_tab_labels_label${activeLabelClass}${tabColorClass}`}
style={tabColorStyle}
key={index}
>
<div
className={tabSpanColorClass}
style={tabSpanColorStyle}
>
{option.tabLabel}
</div>
</li>
);
});
tabList = <ul className={tabListClassName}>{tabListInner}</ul>;
}

const blockProps = useBlockProps.save({
className: `vk_tab`,
id: `vk-tab-id-${blockId}`,
});

return (
<div {...blockProps}>
{tabList}
<div className="vk_tab_bodys">
<InnerBlocks.Content />
</div>
</div>
);
}
39 changes: 39 additions & 0 deletions src/blocks/_pro/tab/deprecated/1.73.0/view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const vkTabs = document.querySelectorAll('.vk_tab');

Array.prototype.forEach.call(vkTabs, (vkTab) => {
const vkTabLabels = vkTab.querySelector('.vk_tab_labels');
const vkTabLabel = vkTab.querySelectorAll('.vk_tab_labels_label');
const vkTabBodies = vkTab.querySelector('.vk_tab_bodys');

Array.prototype.forEach.call(vkTabLabel, (TabLabel) => {
TabLabel.addEventListener('click', (e) => {
// ブロック ID を抽出
const TabLabelId = e.target.closest('.vk_tab_labels_label').id;
const TabId = TabLabelId.replace('vk_tab_labels_label-', '');

// カレントを探して全て外す
const activeLabels = vkTabLabels.querySelectorAll(
'.vk_tab_labels_label-state-active'
);
Array.prototype.forEach.call(activeLabels, (activeLabel) => {
activeLabel.classList.remove(
'vk_tab_labels_label-state-active'
);
});
const activeBodies = vkTabBodies.querySelectorAll(
'.vk_tab_bodys_body-state-active'
);
Array.prototype.forEach.call(activeBodies, (activeBody) => {
activeBody.classList.remove('vk_tab_bodys_body-state-active');
});

// クリックされた要素にアクティブを追加
vkTabLabels
.querySelector(`#vk_tab_labels_label-${TabId}`)
.classList.add('vk_tab_labels_label-state-active');
vkTabBodies
.querySelector(`#vk_tab_bodys_body-${TabId}`)
.classList.add('vk_tab_bodys_body-state-active');
});
});
});
37 changes: 37 additions & 0 deletions src/blocks/_pro/tab/deprecated/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import save1_73_0 from './1.73.0/save';

const blockAttributes = {
tabOptionJSON: {
type: 'string',
default: '[]',
},
tabSizeSp: {
type: 'string',
default: 'fitText',
},
tabSizeTab: {
type: 'string',
default: 'fitText',
},
tabSizePc: {
type: 'string',
default: 'fitText',
},
firstActive: {
type: 'number',
default: 0,
},
blockId: {
type: 'string',
default: '',
},
};

const deprecated = [
{
attributes: blockAttributes,
save: save1_73_0,
},
];

export default deprecated;
Loading

0 comments on commit f1b579a

Please sign in to comment.