Skip to content

Commit

Permalink
Merge pull request #483 from tomusborne/release/3.2.4
Browse files Browse the repository at this point in the history
Release: 3.2.4
  • Loading branch information
tomusborne authored Nov 22, 2022
2 parents 603a2df + 645968e commit e7fbf56
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 14 deletions.
2 changes: 1 addition & 1 deletion assets/dist/customizer.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '8ea6e41d478be8b7d0dac74069cb0dba');
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '481830d227feca63c062a3e2d512e01c');
6 changes: 3 additions & 3 deletions assets/dist/customizer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/dist/dashboard.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '42891bd78f46f557a7fcfe466a6f3080');
<?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '0b0b00a375613f57beee85895b88af90');
2 changes: 1 addition & 1 deletion assets/dist/dashboard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

// Set our theme version.
define( 'GENERATE_VERSION', '3.2.3' );
define( 'GENERATE_VERSION', '3.2.4' );

if ( ! function_exists( 'generate_setup' ) ) {
add_action( 'after_setup_theme', 'generate_setup' );
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generatepress",
"version": "3.2.3",
"version": "3.2.4",
"description": "A super lightweight WordPress theme.",
"main": "Gruntfile.js",
"scripts": {
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options
Requires at least: 5.2
Tested up to: 6.1
Stable tag: 3.2.3
Stable tag: 3.2.4

GeneratePress is a lightweight WordPress theme built with a focus on speed and usability.

Expand Down Expand Up @@ -99,6 +99,12 @@ MIT License: https://github.com/JedWatson/react-select/blob/master/LICENSE

== Changelog ==

= 3.2.4 =

Release date: November 22, 2022

* Fix: Kebab-case formatting for global colors variable names

= 3.2.3 =

Release date: November 17, 2022
Expand Down
25 changes: 21 additions & 4 deletions src/components/color-picker/GlobalColorPicker.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
import { kebabCase, toLower } from 'lodash';
import { toLower } from 'lodash';
import ColorPicker from './index';
import { useCallback, useEffect, useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';

/**
* Transform a string to kebab case.
*
* @param {string} input The input to transform.
* @return {string} The input transformed to kebab case.
*/
function kebabCase( input ) {
return input
.replace( /[^a-zA-Z0-9\s-_]/g, '' ) // Remove special characters, except spaces, underscore, and the dash.
.trim() // Remove starting/ending spaces.
.replace( /[\s_]+/g, '-' ) // Replaces spaces and underscores to single dash.
.replace( /([a-z])([A-Z])/g, '$1-$2' ) // Split when lower case is before an upper case.
.toLowerCase();
}

export default function GlobalColorPicker( props ) {
const { index, value, variableName, onChange, onChangeVariableName, checkVariableNameIsAvailable } = props;
const [ isVariableNameDisabled, setVariableNameDisabled ] = useState( !! value );
Expand All @@ -18,7 +33,7 @@ export default function GlobalColorPicker( props ) {
useEffect( () => {
setVariableNameValid( checkVariableNameIsAvailable( toLower( localVariableName ), index ) );

const regex = new RegExp("[^a-z0-9\\-]");
const regex = new RegExp( /[^a-z0-9\\-]/ );
setVariableNameHasSpecialChars( regex.test( localVariableName ) );
}, [ localVariableName ] );

Expand All @@ -38,7 +53,10 @@ export default function GlobalColorPicker( props ) {

const updateVariableName = useCallback( () => {
if ( isVariableNameValid ) {
onChangeVariableName( kebabCase( toLower( localVariableName ) ) );
const kebabVariable = kebabCase( localVariableName );

onChangeVariableName( kebabVariable );
setLocalVariableName( kebabVariable );
} else {
setLocalVariableName( variableName );
}
Expand All @@ -60,7 +78,6 @@ export default function GlobalColorPicker( props ) {
onChange={ onChange }
onClosePanel={ () => {
setVariableNameDisabled( true );
updateVariableName();
} }
onChangeVariableName={ setLocalVariableName }
onBlurVariableName={ updateVariableName }
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Theme URI: https://generatepress.com
Author: Tom Usborne
Author URI: https://tomusborne.com
Description: GeneratePress is a lightweight WordPress theme built with a focus on speed and usability. Performance is important to us, which is why a fresh GeneratePress install adds less than 10kb (gzipped) to your page size. We take full advantage of the block editor (Gutenberg), which gives you more control over creating your content. If you use page builders, GeneratePress is the right theme for you. It is completely compatible with all major page builders, including Beaver Builder and Elementor. Thanks to our emphasis on WordPress coding standards, we can boast full compatibility with all well-coded plugins, including WooCommerce. GeneratePress is fully responsive, uses valid HTML/CSS, and is translated into over 25 languages by our amazing community of users. A few of our many features include 60+ color controls, powerful dynamic typography, 5 navigation locations, 5 sidebar layouts, dropdown menus (click or hover), and 9 widget areas. Learn more and check out our powerful premium version at https://generatepress.com
Version: 3.2.3
Version: 3.2.4
Requires at least: 5.2
Tested up to: 6.1
Requires PHP: 5.6
Expand Down

0 comments on commit e7fbf56

Please sign in to comment.