From c2cefb627ae4d09f871011c48a8a88edc1e0b56e Mon Sep 17 00:00:00 2001 From: Soare Robert Daniel Date: Wed, 3 Aug 2022 15:07:30 +0300 Subject: [PATCH 1/3] fix: value inheritance & cleaning --- src/blocks/blocks/section/column/inspector.js | 19 ++++++++++--------- .../blocks/section/columns/inspector.js | 16 ++++++++-------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/blocks/blocks/section/column/inspector.js b/src/blocks/blocks/section/column/inspector.js index 300b6eb90..1a40ca272 100644 --- a/src/blocks/blocks/section/column/inspector.js +++ b/src/blocks/blocks/section/column/inspector.js @@ -39,7 +39,7 @@ import ResponsiveControl from '../../../components/responsive-control/index.js'; import BackgroundSelectorControl from '../../../components/background-selector-control/index.js'; import ControlPanelControl from '../../../components/control-panel-control/index.js'; import SyncControl from '../../../components/sync-control/index.js'; -import { isNullObject } from '../../../helpers/helper-functions.js'; +import { isNullObject, removeBoxDefaultValues } from '../../../helpers/helper-functions.js'; /** * @@ -90,13 +90,14 @@ const Inspector = ({ }; const getPadding = () => { + console.log({ getView }); switch ( getView ) { case 'Desktop': return getValue( 'padding' ); case 'Tablet': - return merge( getValue( 'padding' ), getValue( 'paddingTablet' ) ); + return merge({ ...getValue( 'padding' ) }, getValue( 'paddingTablet' ) ); case 'Mobile': - return merge( getValue( 'padding' ), getValue( 'paddingTablet' ), getValue( 'paddingMobile' ) ); + return merge({ ...getValue( 'padding' ) }, getValue( 'paddingTablet' ), getValue( 'paddingMobile' ) ); default: return undefined; } @@ -111,9 +112,9 @@ const Inspector = ({ case 'Desktop': return setAttributes({ padding: value }); case 'Tablet': - return setAttributes({ paddingTablet: value }); + return setAttributes({ paddingTablet: removeBoxDefaultValues( value, attributes.padding ) }); case 'Mobile': - return setAttributes({ paddingMobile: value }); + return setAttributes({ paddingMobile: removeBoxDefaultValues( value, { ...attributes.padding, ...attributes.paddingTablet }) }); default: return undefined; } @@ -137,9 +138,9 @@ const Inspector = ({ case 'Desktop': return getValue( 'margin' ); case 'Tablet': - return merge( getValue( 'margin' ), getValue( 'marginTablet' ) ); + return merge({ ...getValue( 'margin' ) }, getValue( 'marginTablet' ) ); case 'Mobile': - return merge( getValue( 'margin' ), getValue( 'marginTablet' ), getValue( 'marginMobile' ) ); + return merge({ ...getValue( 'margin' ) }, getValue( 'marginTablet' ), getValue( 'marginMobile' ) ); default: return undefined; } @@ -154,9 +155,9 @@ const Inspector = ({ case 'Desktop': return setAttributes({ margin: value }); case 'Tablet': - return setAttributes({ marginTablet: value }); + return setAttributes({ marginTablet: removeBoxDefaultValues( value, attributes.margin ) }); case 'Mobile': - return setAttributes({ marginMobile: value }); + return setAttributes({ marginMobile: removeBoxDefaultValues( value, { ...attributes.margin, ...attributes.marginTablet }) }); default: return undefined; } diff --git a/src/blocks/blocks/section/columns/inspector.js b/src/blocks/blocks/section/columns/inspector.js index e54d156ae..f237ce93e 100644 --- a/src/blocks/blocks/section/columns/inspector.js +++ b/src/blocks/blocks/section/columns/inspector.js @@ -131,9 +131,9 @@ const Inspector = ({ case 'Desktop': return getValue( 'padding' ); case 'Tablet': - return merge( getValue( 'padding' ), getValue( 'paddingTablet' ) ); + return merge({ ...getValue( 'padding' ) }, getValue( 'paddingTablet' ) ); case 'Mobile': - return merge( getValue( 'padding' ), getValue( 'paddingTablet' ), getValue( 'paddingMobile' ) ) ; + return merge({ ...getValue( 'padding' ) }, getValue( 'paddingTablet' ), getValue( 'paddingMobile' ) ) ; default: return undefined; } @@ -148,9 +148,9 @@ const Inspector = ({ case 'Desktop': return setAttributes({ padding: value }); case 'Tablet': - return setAttributes({ paddingTablet: value }); + return setAttributes({ paddingTablet: removeBoxDefaultValues( value, attributes.padding ) }); case 'Mobile': - return setAttributes({ paddingMobile: value }); + return setAttributes({ paddingMobile: removeBoxDefaultValues( value, { ...attributes.padding, ...attributes.paddingTablet }) }); default: return undefined; } @@ -174,9 +174,9 @@ const Inspector = ({ case 'Desktop': return getValue( 'margin' ); case 'Tablet': - return merge( getValue( 'margin' ), getValue( 'marginTablet' ) ); + return merge({ ...getValue( 'margin' ) }, getValue( 'marginTablet' ) ); case 'Mobile': - return merge( getValue( 'margin' ), getValue( 'marginTablet' ), getValue( 'marginMobile' ) ); + return merge({ ...getValue( 'margin' ) }, getValue( 'marginTablet' ), getValue( 'marginMobile' ) ); default: return undefined; } @@ -197,9 +197,9 @@ const Inspector = ({ case 'Desktop': return setAttributes({ margin: value }); case 'Tablet': - return setAttributes({ marginTablet: value }); + return setAttributes({ marginTablet: removeBoxDefaultValues( value, attributes.margin ) }); case 'Mobile': - return setAttributes({ marginMobile: value }); + return setAttributes({ marginMobile: removeBoxDefaultValues( value, { ...attributes.margin, ...attributes.marginTablet }) }); default: return undefined; } From 29484c7777dfae4580df2e357b1f79ba43ffc725 Mon Sep 17 00:00:00 2001 From: Soare Robert Daniel Date: Thu, 4 Aug 2022 10:24:26 +0300 Subject: [PATCH 2/3] feat: add missing import --- src/blocks/blocks/section/columns/inspector.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/blocks/blocks/section/columns/inspector.js b/src/blocks/blocks/section/columns/inspector.js index f237ce93e..a446fa967 100644 --- a/src/blocks/blocks/section/columns/inspector.js +++ b/src/blocks/blocks/section/columns/inspector.js @@ -44,7 +44,7 @@ import ControlPanelControl from '../../../components/control-panel-control/index import HTMLAnchorControl from '../../../components/html-anchor-control/index.js'; import BackgroundSelectorControl from '../../../components/background-selector-control/index.js'; import SyncControl from '../../../components/sync-control/index.js'; -import { isNullObject } from '../../../helpers/helper-functions.js'; +import { isNullObject, removeBoxDefaultValues } from '../../../helpers/helper-functions.js'; import ToogleGroupControl from '../../../components/toogle-group-control/index.js'; /** @@ -187,8 +187,6 @@ const Inspector = ({ value = undefined; } - console.log( value ); - if ( 'object' === typeof value ) { value = Object.fromEntries( Object.entries( value ).filter( ([ _, v ]) => null !== v ) ); } From 2c02f4c0987204dbd18e7c8e0ee2447c6ee7efb3 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Thu, 4 Aug 2022 22:01:24 +0530 Subject: [PATCH 3/3] Minor fixes --- inc/class-pro.php | 4 ++++ src/blocks/blocks/section/column/inspector.js | 6 ++++-- src/blocks/blocks/section/columns/inspector.js | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/inc/class-pro.php b/inc/class-pro.php index 833c8a32b..af010a25b 100644 --- a/inc/class-pro.php +++ b/inc/class-pro.php @@ -107,6 +107,10 @@ public static function get_docs_url() { public static function should_show_upsell() { $show_upsell = false; + if ( defined( 'OTTER_PRO_VERSION' ) ) { + return $show_upsell; + } + $installed = get_option( 'otter_blocks_install' ); $notifications = get_option( 'themeisle_blocks_settings_notifications', array() ); diff --git a/src/blocks/blocks/section/column/inspector.js b/src/blocks/blocks/section/column/inspector.js index 1a40ca272..ab0ef2b87 100644 --- a/src/blocks/blocks/section/column/inspector.js +++ b/src/blocks/blocks/section/column/inspector.js @@ -39,7 +39,10 @@ import ResponsiveControl from '../../../components/responsive-control/index.js'; import BackgroundSelectorControl from '../../../components/background-selector-control/index.js'; import ControlPanelControl from '../../../components/control-panel-control/index.js'; import SyncControl from '../../../components/sync-control/index.js'; -import { isNullObject, removeBoxDefaultValues } from '../../../helpers/helper-functions.js'; +import { + isNullObject, + removeBoxDefaultValues +} from '../../../helpers/helper-functions.js'; /** * @@ -90,7 +93,6 @@ const Inspector = ({ }; const getPadding = () => { - console.log({ getView }); switch ( getView ) { case 'Desktop': return getValue( 'padding' ); diff --git a/src/blocks/blocks/section/columns/inspector.js b/src/blocks/blocks/section/columns/inspector.js index a446fa967..9bb5c08e9 100644 --- a/src/blocks/blocks/section/columns/inspector.js +++ b/src/blocks/blocks/section/columns/inspector.js @@ -44,7 +44,10 @@ import ControlPanelControl from '../../../components/control-panel-control/index import HTMLAnchorControl from '../../../components/html-anchor-control/index.js'; import BackgroundSelectorControl from '../../../components/background-selector-control/index.js'; import SyncControl from '../../../components/sync-control/index.js'; -import { isNullObject, removeBoxDefaultValues } from '../../../helpers/helper-functions.js'; +import { + isNullObject, + removeBoxDefaultValues +} from '../../../helpers/helper-functions.js'; import ToogleGroupControl from '../../../components/toogle-group-control/index.js'; /**