Skip to content

Commit

Permalink
Merge branch 'release/2.20.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Dec 2, 2022
2 parents 3b46568 + 6f0c212 commit 0fb79bb
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
12 changes: 10 additions & 2 deletions inc/styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static function register_scripts() {

wp_localize_script( 'simpleParallax', 'parallaxStyles', array(
'mobile-breakpoint' => siteorigin_panels_setting( 'mobile-width' ) . 'px',
'disable-parallax-mobile' => ! empty( siteorigin_panels_setting( 'parallax-mobile' ) ) ?: siteorigin_panels_setting( 'parallax-mobile' ),
'disable-parallax-mobile' => ! empty( siteorigin_panels_setting( 'parallax-mobile' ) ),
'delay' => ! empty( siteorigin_panels_setting( 'parallax-delay' ) ) ? siteorigin_panels_setting( 'parallax-delay' ) : 0.4,
'scale' => ! empty( siteorigin_panels_setting( 'parallax-scale' ) ) ? siteorigin_panels_setting( 'parallax-scale' ) : 1.1,
) );
Expand Down Expand Up @@ -232,6 +232,14 @@ static function get_general_style_fields( $id, $label ) {
'priority' => 10,
);

$fields['border_thickness'] = array(
'name' => __( 'Border Thickness', 'siteorigin-panels' ),
'type' => 'measurement',
'group' => 'design',
'default' => '1px',
'priority' => 11,
);

$fields['border_radius'] = array(
'name' => __( 'Border Radius', 'siteorigin-panels' ),
'type' => 'measurement',
Expand Down Expand Up @@ -770,7 +778,7 @@ static function general_style_css( $css, $style ) {
}

if ( ! empty( $style[ 'border_color' ] ) ) {
$css[ 'border' ] = '1px solid ' . $style['border_color'];
$css[ 'border' ] = ( ! empty( $style['border_thickness'] ) ? $style['border_thickness'] : '1px' ) . ' solid ' . $style['border_color'];
}

if ( ! empty( $style[ 'font_color' ] ) ) {
Expand Down
28 changes: 28 additions & 0 deletions js/siteorigin-panels/view/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ module.exports = Backbone.View.extend( {
return el;
} );
}

// Trigger a change event when user selects a color.
panelsOptions.wpColorPickerOptions.change = function( e, ui ) {
setTimeout( function() {
$( e.target ).trigger( 'change' );
}, 100 );
};

this.$( '.so-wp-color-field' ).wpColorPicker( panelsOptions.wpColorPickerOptions );
}

Expand Down Expand Up @@ -322,6 +330,7 @@ module.exports = Backbone.View.extend( {
} );
this.$( '.style-field-toggle .so-toggle-switch-input' ).trigger( 'change' );

// Conditionally show Background related settings.
var $background_image = this.$( '.so-field-background_image_attachment' ),
$background_image_display = this.$( '.so-field-background_display' ),
$background_image_size = this.$( '.so-field-background_image_size' );
Expand Down Expand Up @@ -352,6 +361,25 @@ module.exports = Backbone.View.extend( {
$background_image.find( '[name="style[background_image_attachment]"], [name="style[background_image_attachment_fallback]"]' ).on( 'change', soBackgroundImageVisibility );
}

// Conditionally show Border related settings.
var $border_color = this.$( '.so-field-border_color' ),
$border_thickness = this.$( '.so-field-border_thickness' );

if ( $border_color.length && $border_thickness.length ) {
var soBorderVisibility = function() {
if ( $border_color.find( '.so-wp-color-field' ).val() ) {
$border_thickness.show();
$border_thickness.show();
} else {
$border_thickness.hide();
$border_thickness.hide();
}
}
soBorderVisibility();
$border_color.find( '.so-wp-color-field' ).on( 'change', soBorderVisibility );
$border_color.find( '.wp-picker-clear' ).on( 'click', soBorderVisibility );
}

// Allow other plugins to setup custom fields.
$( document ).trigger( 'setup_style_fields', this );
}
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ SiteOrigin Premium includes access to our professional email support service, pe

== Changelog ==

= 2.20.0 - 02 December 2022 =
* Styles: Added a row, cell, and widget `Border Thickness` setting.
* Parallax: Resolved `Disable Parallax On Mobile` setting bug.

= 2.19.0 - 22 November 2022 =
* Styles: Added a row, cell, and widget `Background Image Size` setting.

Expand Down

0 comments on commit 0fb79bb

Please sign in to comment.