diff --git a/readme.txt b/readme.txt index 56bb5f440..4673f588a 100644 --- a/readme.txt +++ b/readme.txt @@ -108,9 +108,10 @@ e.g. == Changelog == [ Add function ][ group ] Added noreferrer, nofollow, and link description options to the link feature. - +[ Add function ][ Icon / Slider ] Added noreferrer, nofollow, and link description options to the link feature. +[ Add function ][ Grid Column Card (Pro) ] Added noreferrer and nofollow to the link feature. +[ Editor Design Bug Fix ] [ Grid Column (Pro) ] Fixed an issue where the 'is-vertical' layout of grid column items was not displayed vertically. [ Add function ][ Slider ] Added noreferrer, nofollow, and link description options to the link feature. - [ Add function ][ Animation (Pro) / Fixed Display (Pro) / Outer (Pro) ] Added support for layout.allowJustification: false, allowing full-width/wide alignment in block themes where wrapped blocks previously did not appear as full-width or wide in the editor. [ Bug fix ][ Icon ] Fixed an unwanted bottom margin appearing. [ Specification change ] Fixed the zoom-out toggle not always displaying in the editor toolbar (updated blocks.json API version from 2 to 3). diff --git a/src/blocks/_pro/gridcolcard-item/block.json b/src/blocks/_pro/gridcolcard-item/block.json index 6bb16146c..826f4350d 100644 --- a/src/blocks/_pro/gridcolcard-item/block.json +++ b/src/blocks/_pro/gridcolcard-item/block.json @@ -70,11 +70,16 @@ "type": "string" }, "url": { - "type": "string" + "type": "string", + "default": "" }, "urlOpenType": { "type": "boolean", "default": false + }, + "relAttribute": { + "type": "string", + "default": "" } } } diff --git a/src/blocks/_pro/gridcolcard-item/deprecated/1.95.0/save.js b/src/blocks/_pro/gridcolcard-item/deprecated/1.95.0/save.js new file mode 100644 index 000000000..2a75da6fe --- /dev/null +++ b/src/blocks/_pro/gridcolcard-item/deprecated/1.95.0/save.js @@ -0,0 +1,109 @@ +import { InnerBlocks, useBlockProps } from '@wordpress/block-editor'; +import { isHexColor } from '@vkblocks/utils/is-hex-color'; +import { isGradientStyle } from '@vkblocks/utils/is-gradient-style'; + +import classnames from 'classnames'; + +export default function save(props) { + const { attributes } = props; + const { + backgroundColor, + textColor, + headerDisplay, + footerDisplay, + containerSpace, + borderRadius, + border, + borderColor, + borderWidth, + backgroundGradient, + url, + urlOpenType, + } = attributes; + + // カラーパレットに対応 + const containerClasses = classnames('vk_gridcolcard_item', { + [`vk_gridcolcard_item-noHeader`]: headerDisplay === 'delete', + [`vk_gridcolcard_item-noFooter`]: footerDisplay === 'delete', + [`has-background`]: !!backgroundColor, + [`has-border-color`]: !!border, + [`has-${backgroundColor}-background-color`]: + !!backgroundColor && !isHexColor(backgroundColor), + [`has-${backgroundGradient}-gradient-background`]: + !!backgroundGradient && !isGradientStyle(backgroundGradient), + [`has-${borderColor}-border-color`]: + !!border && !!borderColor && !isHexColor(borderColor), + }); + + const innerClasses = classnames('vk_gridcolcard_item_container', { + [`has-text-color`]: !!textColor, + [`has-${textColor}-color`]: !!textColor && !isHexColor(textColor), + }); + + const style = { + backgroundColor: null, + border: null, + }; + if (borderRadius) { + style.borderRadius = `${borderRadius}`; + } + + // 背景色 + if (backgroundColor && isHexColor(backgroundColor)) { + // custom color + style.backgroundColor = `${backgroundColor}`; + } + + // 背景グラデーション + if (backgroundGradient && isGradientStyle(backgroundGradient)) { + // custom color + style.background = `${backgroundGradient}`; + } + + // 線の色と太さ + if (border) { + style.borderWidth = borderWidth; + if (isHexColor(borderColor)) { + // custom color + style.borderColor = `${borderColor}`; + } + } + + // 文字色 + const textColorCustom = + textColor && isHexColor(textColor) ? textColor : null; + + const blockProps = useBlockProps.save({ + className: classnames(containerClasses, { + 'vk_gridcolcard_item-noHeader': headerDisplay === 'delete', + 'vk_gridcolcard_item-noFooter': footerDisplay === 'delete', + [`vk_gridcolcard_item-header-${headerDisplay}`]: + headerDisplay !== 'delete', + [`vk_gridcolcard_item-footer-${footerDisplay}`]: + footerDisplay !== 'delete', + }), + style, + }); + + const TagName = url ? 'a' : 'div'; + + return ( +
{__(
'If you set a link URL, do not place the link element (text or button) in the Grid Column Card Item. It may not be displayed correctly.',
diff --git a/src/blocks/_pro/gridcolcard-item/save.js b/src/blocks/_pro/gridcolcard-item/save.js
index 2a75da6fe..0a315340c 100644
--- a/src/blocks/_pro/gridcolcard-item/save.js
+++ b/src/blocks/_pro/gridcolcard-item/save.js
@@ -1,7 +1,6 @@
import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
import { isHexColor } from '@vkblocks/utils/is-hex-color';
import { isGradientStyle } from '@vkblocks/utils/is-gradient-style';
-
import classnames from 'classnames';
export default function save(props) {
@@ -19,6 +18,7 @@ export default function save(props) {
backgroundGradient,
url,
urlOpenType,
+ relAttribute,
} = attributes;
// カラーパレットに対応
@@ -98,9 +98,13 @@ export default function save(props) {
paddingRight: containerSpace.right,
color: textColorCustom,
}}
- href={url}
- target={urlOpenType ? '_blank' : undefined}
- rel={urlOpenType ? 'noopener noreferrer' : undefined}
+ {...(TagName === 'a'
+ ? {
+ href: url,
+ target: urlOpenType ? '_blank' : undefined,
+ rel: relAttribute || undefined,
+ }
+ : {})}
>