From f5b5585211944035c13f7813af6c74faaa88e6ad Mon Sep 17 00:00:00 2001 From: sysbird Date: Mon, 15 Aug 2022 18:18:38 +0900 Subject: [PATCH 1/3] set default background color --- src/blocks/button/edit.js | 5 +++++ src/blocks/button/style.scss | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/blocks/button/edit.js b/src/blocks/button/edit.js index a9dceda61..186c5afe2 100644 --- a/src/blocks/button/edit.js +++ b/src/blocks/button/edit.js @@ -75,6 +75,7 @@ export default function ButtonEdit(props) { setAttributes({ buttonUrl: undefined }); } if (buttonColorCustom === undefined) { + setAttributes({ buttonColor: 'primary' }); setAttributes({ buttonTextColorCustom: undefined }); } if ( @@ -148,6 +149,10 @@ export default function ButtonEdit(props) { if (buttonColorCustom !== undefined) { updateBlockAttributes(clientId, { buttonColor: 'custom' }); } + else{ + // 背景色がクリアされたらデフォルトに戻す +// updateBlockAttributes(clientId, { buttonColor: 'primary' }); + } }, [buttonColorCustom]); // 親ブロックが vk-blocks/button-outer かどうか判定 diff --git a/src/blocks/button/style.scss b/src/blocks/button/style.scss index 3678bb639..444ca541e 100644 --- a/src/blocks/button/style.scss +++ b/src/blocks/button/style.scss @@ -404,3 +404,9 @@ $xxl-min: 1400px; display: inline-block; } } + +// 背景色が不明の場合 + .has-background, +.editor-styles-wrapper .has-background { + background-color: var(--vk-color-primary); +} \ No newline at end of file From 71e1be334ec3f07997950ccb1e33aecaf159f995 Mon Sep 17 00:00:00 2001 From: sysbird Date: Tue, 16 Aug 2022 16:08:10 +0900 Subject: [PATCH 2/3] buttonColor clear convert to primary --- src/blocks/button/edit.js | 8 +++----- src/blocks/button/style.scss | 13 +++++-------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/blocks/button/edit.js b/src/blocks/button/edit.js index 186c5afe2..af304e3c4 100644 --- a/src/blocks/button/edit.js +++ b/src/blocks/button/edit.js @@ -75,7 +75,6 @@ export default function ButtonEdit(props) { setAttributes({ buttonUrl: undefined }); } if (buttonColorCustom === undefined) { - setAttributes({ buttonColor: 'primary' }); setAttributes({ buttonTextColorCustom: undefined }); } if ( @@ -148,10 +147,9 @@ export default function ButtonEdit(props) { useEffect(() => { if (buttonColorCustom !== undefined) { updateBlockAttributes(clientId, { buttonColor: 'custom' }); - } - else{ - // 背景色がクリアされたらデフォルトに戻す -// updateBlockAttributes(clientId, { buttonColor: 'primary' }); + } else if (buttonColor === 'custom') { + // 背景色クリアされたらデフォルトに戻す + updateBlockAttributes(clientId, { buttonColor: 'primary' }); } }, [buttonColorCustom]); diff --git a/src/blocks/button/style.scss b/src/blocks/button/style.scss index 444ca541e..523efea96 100644 --- a/src/blocks/button/style.scss +++ b/src/blocks/button/style.scss @@ -20,7 +20,8 @@ $xxl-min: 1400px; :root, :root .editor-styles-wrapper { - .has-vk-color-primary-background-color { + .has-vk-color-primary-background-color, + .has-undefined-background-color { background-color: var(--vk-color-primary); } .has-vk-color-secondary-background-color { @@ -367,6 +368,8 @@ $xxl-min: 1400px; user-select: text; text-decoration: none; font-size: calc( var(--vk-size-text) * 1 ); + + } &.btn-lg{ font-size:calc( var(--vk-size-text) * 1.25 ); @@ -403,10 +406,4 @@ $xxl-min: 1400px; // Font Awesomeアイコンが管理画面側で改行されないために inline-block を指定 display: inline-block; } -} - -// 背景色が不明の場合 - .has-background, -.editor-styles-wrapper .has-background { - background-color: var(--vk-color-primary); -} \ No newline at end of file +} \ No newline at end of file From c52a2b99b6a15d8272718dbb1ef4cc7c73793731 Mon Sep 17 00:00:00 2001 From: sysbird Date: Tue, 16 Aug 2022 16:21:11 +0900 Subject: [PATCH 3/3] readme --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index 8eb749b80..c2fa4a2ad 100644 --- a/readme.txt +++ b/readme.txt @@ -65,6 +65,7 @@ e.g. == Changelog == [ Bug Fix ][ highlighter ] cope with color palette with alpha. +[ Bug Fix ][ button ] buttonColorCustom clear convert to primary. = 1.41.1 = [ Bug Fix ] Fix don't display Admin screen in case of spacific option value