From da4b17242be696d7a815a545d89aa6f805e53555 Mon Sep 17 00:00:00 2001 From: Rens Date: Mon, 4 Jan 2021 17:10:54 +0100 Subject: [PATCH] fix scrolling bug backend, US states order, dropdown default items --- docs/changelog.md | 6 ++++++ .../css/backend/create-form-responsive.css | 4 ++-- src/assets/js/backend/create-form.js | 2 ++ src/assets/js/common.js | 5 ++++- src/docs/changelog.md | 6 ++++++ src/includes/class-common.php | 2 +- src/includes/class-shortcodes.php | 19 ++++++++++--------- src/super-forms.php | 6 +++--- 8 files changed, 34 insertions(+), 16 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index f31cd0f4..f353612f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,12 @@ - [PDF Generator Add-on](https://renstillmann.github.io/super-forms/#/pdf-generator-add-on) +## Jan 04, 2020 - Version 4.9.572 + +- **Fix:** Builder UI scrolling bug in Firefox browser causing a continues scroll +- **Fix:** When selecting default items for `Dropdown` element it would still display the placeholder instead of the actual selected item +- **Fix:** US States element contained some incorrectly sorted items by alphabet + ## Dec 24, 2020 - Version 4.9.571 - **Fix:** Issue with SMTP on older PHP versions due to WordPress moving the class to a different location diff --git a/src/assets/css/backend/create-form-responsive.css b/src/assets/css/backend/create-form-responsive.css index 8c9d076d..bad55e11 100644 --- a/src/assets/css/backend/create-form-responsive.css +++ b/src/assets/css/backend/create-form-responsive.css @@ -89,7 +89,7 @@ max-height: inherit!important; } } -@media only screen and (min-width: 480px) and (max-width: 1145px) { +@media only screen and (min-width: 0px) and (max-width: 1145px) { .super-switch-forms { margin-bottom: 5px; } @@ -257,7 +257,7 @@ } @media only screen and (min-width: 1000px) and (max-width: 1679px) { .super-element > .super-elements-container > .super-element { - width: 50%; + width: 33%; } } diff --git a/src/assets/js/backend/create-form.js b/src/assets/js/backend/create-form.js index 893dce4f..93446bff 100644 --- a/src/assets/js/backend/create-form.js +++ b/src/assets/js/backend/create-form.js @@ -1063,6 +1063,7 @@ jQuery(document).ready(function ($) { $('body.wp-admin').addClass('folded'); + init_form_settings_container_heights(); var $doc = $(document), $super_hints, @@ -1120,6 +1121,7 @@ } // Remember which TAB was active for the last time SUPER.set_session_data('_super_builder_last_active_panel', $(this).parent().index()); + init_form_settings_container_heights(); return false; }); diff --git a/src/assets/js/common.js b/src/assets/js/common.js index bbb76691..37f506fe 100644 --- a/src/assets/js/common.js +++ b/src/assets/js/common.js @@ -5325,7 +5325,7 @@ function SUPERreCaptcha(){ if($new_placeholder===''){ $new_placeholder += $(this).html(); }else{ - $new_placeholder += ','+$(this).html(); + $new_placeholder += ', '+$(this).html(); } } }); @@ -5627,6 +5627,9 @@ function SUPERreCaptcha(){ for (ii = 0; ii < innerNodes.length; ii++) { innerNodes[ii].classList.add('super-active'); } + if(innerNodes.length){ + field.classList.add('super-filled'); + } if(typeof default_value === 'undefined') default_value = ''; option = field.querySelector('.super-dropdown-ui .super-item:not(.super-placeholder)[data-value="'+default_value+'"]:not(.super-placeholder)'); if(option){ diff --git a/src/docs/changelog.md b/src/docs/changelog.md index f31cd0f4..f353612f 100644 --- a/src/docs/changelog.md +++ b/src/docs/changelog.md @@ -4,6 +4,12 @@ - [PDF Generator Add-on](https://renstillmann.github.io/super-forms/#/pdf-generator-add-on) +## Jan 04, 2020 - Version 4.9.572 + +- **Fix:** Builder UI scrolling bug in Firefox browser causing a continues scroll +- **Fix:** When selecting default items for `Dropdown` element it would still display the placeholder instead of the actual selected item +- **Fix:** US States element contained some incorrectly sorted items by alphabet + ## Dec 24, 2020 - Version 4.9.571 - **Fix:** Issue with SMTP on older PHP versions due to WordPress moving the class to a different location diff --git a/src/includes/class-common.php b/src/includes/class-common.php index 439dda8c..9c413f6c 100644 --- a/src/includes/class-common.php +++ b/src/includes/class-common.php @@ -22,7 +22,7 @@ class SUPER_Common { // @since 4.7.7 - US states (currently used by dropdown element only) public static function us_states(){ - return array('Alabama'=>'AL','Alaska'=>'AK','Arizona'=>'AZ','Arkansas'=>'AR','California'=>'CA','Colorado'=>'CO','Connecticut'=>'CT','Delaware'=>'DE','District of Columbia'=>'DC','Florida'=>'FL','Georgia'=>'GA','Hawaii'=>'HI','Idaho'=>'ID','Illinois'=>'IL','Indiana'=>'IN','Iowa'=>'IA','Kansas'=>'KS','Kentucky'=>'KY','Louisiana'=>'LA','Maine'=>'ME','Montana'=>'MT','Nebraska'=>'NE','Nevada'=>'NV','New Hampshire'=>'NH','New Jersey'=>'NJ','New Mexico'=>'NM','New York'=>'NY','North Carolina'=>'NC','North Dakota'=>'ND','Ohio'=>'OH','Oklahoma'=>'OK','Oregon'=>'OR','Maryland'=>'MD','Massachusetts'=>'MA','Michigan'=>'MI','Minnesota'=>'MN','Mississippi'=>'MS','Missouri'=>'MO','Pennsylvania'=>'PA','Rhode Island'=>'RI','South Carolina'=>'SC','South Dakota'=>'SD','Tennessee'=>'TN','Texas'=>'TX','Utah'=>'UT','Vermont'=>'VT','Virginia'=>'VA','Washington'=>'WA','West Virginia'=>'WV','Wisconsin'=>'WI','Wyoming'=>'WY'); + return array( 'Alabama'=>'AL', 'Alaska'=>'AK', 'Arizona'=>'AZ', 'Arkansas'=>'AR', 'California'=>'CA', 'Colorado'=>'CO', 'Connecticut'=>'CT', 'Delaware'=>'DE', 'District of Columbia'=>'DC', 'Florida'=>'FL', 'Georgia'=>'GA', 'Hawaii'=>'HI', 'Idaho'=>'ID', 'Illinois'=>'IL', 'Indiana'=>'IN', 'Iowa'=>'IA', 'Kansas'=>'KS', 'Kentucky'=>'KY', 'Louisiana'=>'LA', 'Maine'=>'ME', 'Maryland'=>'MD', 'Massachusetts'=>'MA', 'Michigan'=>'MI', 'Minnesota'=>'MN', 'Mississippi'=>'MS', 'Missouri'=>'MO', 'Montana'=>'MT', 'Nebraska'=>'NE', 'Nevada'=>'NV', 'New Hampshire'=>'NH', 'New Jersey'=>'NJ', 'New Mexico'=>'NM', 'New York'=>'NY', 'North Carolina'=>'NC', 'North Dakota'=>'ND', 'Ohio'=>'OH', 'Oklahoma'=>'OK', 'Oregon'=>'OR', 'Pennsylvania'=>'PA', 'Rhode Island'=>'RI', 'South Carolina'=>'SC', 'South Dakota'=>'SD', 'Tennessee'=>'TN', 'Texas'=>'TX', 'Utah'=>'UT', 'Vermont'=>'VT', 'Virginia'=>'VA', 'Washington'=>'WA', 'West Virginia'=>'WV', 'Wisconsin'=>'WI', 'Wyoming'=>'WY'); } // @since 4.7.7 - Countries (currently used by dropdown element only) public static function countries(){ diff --git a/src/includes/class-shortcodes.php b/src/includes/class-shortcodes.php index 009e24ec..1329ecac 100644 --- a/src/includes/class-shortcodes.php +++ b/src/includes/class-shortcodes.php @@ -274,6 +274,7 @@ public static function get_items($items=array(), $tag, $atts, $prefix='', $setti // Check if this should be remembered as the default value set via settings if( ($v['checked']=='true' || $v['checked']==1) ) { $class .= 'super-default-selected'; + $selected_items[] = $v['value']; } if( empty($selected_values) ) { if( ($v['checked']=='true' || $v['checked']==1) ) { @@ -1122,7 +1123,6 @@ public static function get_items($items=array(), $tag, $atts, $prefix='', $setti $atts['placeholder'] = implode(', ', $placeholder); } } - if(empty($atts['value'])){ $atts['value'] = implode( ',', $selected_items ); } @@ -3287,6 +3287,13 @@ public static function dropdown( $tag, $atts, $inner, $shortcodes=null, $setting // Get default value $atts['value'] = self::get_default_value($tag, $atts, $settings, $entry_data); + + // @since 4.7.7 - make sure we do not lose the default placeholder + // This is required for dynamic columns + $atts['default_placeholder'] = $atts['placeholder']; + $get_items = self::get_items(array(), $tag, $atts, '', $settings, $entry_data); + $items = $get_items['items']; + $atts = $get_items['atts']; $result = self::opening_tag( $tag, $atts ); $result .= self::opening_wrapper( $atts, $inner, $shortcodes, $settings ); @@ -3296,19 +3303,13 @@ public static function dropdown( $tag, $atts, $inner, $shortcodes=null, $setting if( !isset( $atts['minlength'] ) ) $atts['minlength'] = 0; if( ($atts['minlength']>1) || ($atts['maxlength']>1) ) $multiple = ' multiple'; - // @since 4.7.7 - make sure we do not lose the default placeholder - // This is required for dynamic columns - $atts['default_placeholder'] = $atts['placeholder']; - $get_items = self::get_items(array(), $tag, $atts, '', $settings, $entry_data); - $items = $get_items['items']; - $atts = $get_items['atts']; - $result .= 'session = new SUPER_Session(); + self::$_instance->session = new SUPER_Session(); } return self::$_instance; }