Skip to content

Commit

Permalink
KAD-3345 text shadow updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbert-hernandez committed Dec 2, 2024
1 parent ec3d223 commit 8835b59
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
$css->add_property( 'background-color', $css->render_color( $attributes['background'] ) );
}
}
if ( isset( $attributes['textShadow'] ) && is_array( $attributes['textShadow'] ) && isset( $attributes['textShadow'][0] ) && is_array( $attributes['textShadow'][0] ) && isset( $attributes['enableTextShadow'] ) && $attributes['enableTextShadow'] ) {
if ( isset( $attributes['textShadow'] ) && is_array( $attributes['textShadow'] ) && isset( $attributes['textShadow'][0] ) && is_array( $attributes['textShadow'][0] ) && ((isset( $attributes['enableTextShadow'] ) && $attributes['enableTextShadow']) || (isset( $attributes['textShadow'][0]['enable'] ) && $attributes['textShadow'][0]['enable']) ) ) {
$css->add_property( 'text-shadow', ( isset( $attributes['textShadow'][0]['hOffset'] ) ? $attributes['textShadow'][0]['hOffset'] : 1 ) . 'px ' . ( isset( $attributes['textShadow'][0]['vOffset'] ) ? $attributes['textShadow'][0]['vOffset'] : 1 ) . 'px ' . ( isset( $attributes['textShadow'][0]['blur'] ) ? $attributes['textShadow'][0]['blur'] : 1 ) . 'px ' . ( isset( $attributes['textShadow'][0]['color'] ) ? $css->render_color( $attributes['textShadow'][0]['color'] ) : 'rgba(0,0,0,0.2)' ) );
}
if ( isset( $attributes['textShadowTablet'] ) && is_array( $attributes['textShadowTablet'] ) && isset( $attributes['textShadowTablet'][0] ) && is_array( $attributes['textShadowTablet'][0] ) && isset( $attributes['enableTextShadow'] ) && $attributes['enableTextShadow'] ) {
if ( isset( $attributes['textShadowTablet'] ) && is_array( $attributes['textShadowTablet'] ) && isset( $attributes['textShadowTablet'][0] ) && is_array( $attributes['textShadowTablet'][0] ) && ((isset( $attributes['enableTextShadow'] ) && $attributes['enableTextShadow']) || (isset( $attributes['textShadow'][0]['enable'] ) && $attributes['textShadow'][0]['enable']) ) ) {
$css->set_media_state('tablet');
$css->add_property( 'text-shadow', ( isset( $attributes['textShadowTablet'][0]['hOffset'] ) ? $attributes['textShadowTablet'][0]['hOffset'] : 1 ) . 'px ' . ( isset( $attributes['textShadowTablet'][0]['vOffset'] ) ? $attributes['textShadowTablet'][0]['vOffset'] : 1 ) . 'px ' . ( isset( $attributes['textShadowTablet'][0]['blur'] ) ? $attributes['textShadowTablet'][0]['blur'] : 1 ) . 'px ' . ( isset( $attributes['textShadowTablet'][0]['color'] ) ? $css->render_color( $attributes['textShadowTablet'][0]['color'] ) : 'rgba(0,0,0,0.2)' ) );
}
if ( isset( $attributes['textShadowMobile'] ) && is_array( $attributes['textShadowMobile'] ) && isset( $attributes['textShadowMobile'][0] ) && is_array( $attributes['textShadowMobile'][0] ) && isset( $attributes['enableTextShadow'] ) && $attributes['enableTextShadow'] ) {
if ( isset( $attributes['textShadowMobile'] ) && is_array( $attributes['textShadowMobile'] ) && isset( $attributes['textShadowMobile'][0] ) && is_array( $attributes['textShadowMobile'][0] ) && ((isset( $attributes['enableTextShadow'] ) && $attributes['enableTextShadow']) || (isset( $attributes['textShadow'][0]['enable'] ) && $attributes['textShadow'][0]['enable']) ) ) {
$css->set_media_state('mobile');
$css->add_property( 'text-shadow', ( isset( $attributes['textShadowMobile'][0]['hOffset'] ) ? $attributes['textShadowMobile'][0]['hOffset'] : 1 ) . 'px ' . ( isset( $attributes['textShadowMobile'][0]['vOffset'] ) ? $attributes['textShadowMobile'][0]['vOffset'] : 1 ) . 'px ' . ( isset( $attributes['textShadowMobile'][0]['blur'] ) ? $attributes['textShadowMobile'][0]['blur'] : 1 ) . 'px ' . ( isset( $attributes['textShadowMobile'][0]['color'] ) ? $css->render_color( $attributes['textShadowMobile'][0]['color'] ) : 'rgba(0,0,0,0.2)' ) );
}
Expand Down
16 changes: 8 additions & 8 deletions src/blocks/advancedheading/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@
"default": [
{
"enable": false,
"color": "rgba(0, 0, 0, 0.2)",
"blur": 1,
"hOffset": 1,
"vOffset": 1
"color": "",
"blur": "",
"hOffset": "",
"vOffset": ""
}
]
},
Expand All @@ -356,10 +356,10 @@
"default": [
{
"enable": false,
"color": "rgba(0, 0, 0, 0.2)",
"blur": 1,
"hOffset": 1,
"vOffset": 1
"color": "",
"blur": "",
"hOffset": "",
"vOffset": ""
}
]
},
Expand Down
5 changes: 5 additions & 0 deletions src/blocks/advancedheading/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@ function KadenceAdvancedHeading(props) {
setAttributes({ tabletMarkBorderStyles: tempBorderStyle });
setAttributes({ mobileMarkBorderStyles: tempBorderStyle });
}

// update enableTextShadow if textShadow[0].enable is true for previous unresponsive setting
if (!enableTextShadow && textShadow[0].enable) {
setAttributes({ enableTextShadow: true });
}
}, []);

let newItems;
Expand Down

0 comments on commit 8835b59

Please sign in to comment.