Skip to content

Commit

Permalink
Fix last rule that wasn’t listed in PHP so settings couldn’t be saved
Browse files Browse the repository at this point in the history
  • Loading branch information
webaxones committed May 24, 2024
1 parent 6e159e7 commit 3e1eec8
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-i18n', 'wp-notices', 'wp-plugins'), 'version' => 'f64e0d3fe707707318f5');
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-i18n', 'wp-notices', 'wp-plugins'), 'version' => '1eeb23951b905cebe87d');
2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion consistency.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Consistency
* Plugin URI: https://www.webaxones.com
* Description: Fixes typographical consistency
* Version: 1.5.6
* Version: 1.5.7
* Requires at least: 6.1
* Requires PHP: 7.4
* Author: Loïc Antignac
Expand Down
1 change: 1 addition & 0 deletions includes/Config/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Rules implements ValueInterface
'regularToGermanBookStyleQuotes' => [ 'de-DE', 'de-AT' ],
'regularToFrenchQuotes' => [ 'fr-FR', 'fr-BE' ],
'regularToFrenchQuotesWithoutSpaces' => [ 'de-CH' ],
'curlyToFrenchQuotes' => [ 'fr-FR', 'fr-BE' ],
'breakingSpace' => [ 'fr-FR', 'fr-BE' ],
'noSpaceBefore' => [ 'fr-FR', 'fr-BE' ],
'spaceBefore' => [ 'en-US', 'en-AU', 'en-CA', 'en-NZ', 'en-ZA', 'en-GB', 'de-DE', 'de-AT', 'de-CH', 'ro-RO' ],
Expand Down
2 changes: 1 addition & 1 deletion includes/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Plugin
*/
protected static function setConstants(): void
{
defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.5.6' );
defined( __NAMESPACE__ . '\VERSION' ) || define( __NAMESPACE__ . '\VERSION', '1.5.7' );
defined( __NAMESPACE__ . '\PLUGIN_URL' ) || define( __NAMESPACE__ . '\PLUGIN_URL', plugin_dir_url( __DIR__ ) );
defined( __NAMESPACE__ . '\PLUGIN_PATH' ) || define( __NAMESPACE__ . '\PLUGIN_PATH', plugin_dir_path( __DIR__ ) );
defined( __NAMESPACE__ . '\OPTION_GROUP' ) || define( __NAMESPACE__ . '\OPTION_GROUP', 'consistency_plugin' );
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": "consistency",
"version": "1.5.6",
"version": "1.5.7",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: webaxones
Tags: block editor, typography, gutenberg
Requires at least: 6.1
Tested up to: 6.5.2
Stable tag: 1.5.6
Stable tag: 1.5.7
Requires PHP: 7.4
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Expand Down Expand Up @@ -69,6 +69,9 @@ The locales supported by this plugin are:

== Changelog ==

= 1.5.7 =
* Fix for last rule

= 1.5.6 =
* Fix for version number

Expand Down
3 changes: 2 additions & 1 deletion src/app/fixes.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ export const fixIt = props => {

if( null === captureGroups || 0 === captureGroups.length ) return
const lengthToGoBack = captureGroups[0].length || 1

// Split the string to process only the part from the cursor position to the end
firstPart = blockContent.substring( 0, cursorPositionInsideHTML - lengthToGoBack )
lastPart = blockContent.substring( cursorPositionInsideHTML - lengthToGoBack, blockContent.length )

// If first part of the string matches but not the lastPart, it means that a character has been typed uncorrected voluntarily before, so it should not be taken into account
isConcerned = reg.mask.test( textContent ) && reg.mask.test( lastPart )

}

// Stop correction if block content isn't concerned by the regex
Expand Down
4 changes: 2 additions & 2 deletions src/config/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ export const rules = [
name: __( 'Space before', 'consistency' ),
description: __( 'Remove any space preceding a character from this list:', 'consistency' )
+ `<span style='display:block;'><code>? ! : ; %</code></span>`,
mask: /([ | ])(?=[\?|\!|\:|\;|\%])/,
replace: '',
mask: /([ | ])(?=[\?|\!|\:|\;|\%])(.)/,
replace: '$2',
nbMoved: -1,
locales: [ 'en_US', 'en_AU', 'en_CA', 'en_NZ', 'en_ZA', 'en_GB', 'de_DE', 'de_AT', 'de_CH', 'ro_RO' ],
category: 'space'
Expand Down

0 comments on commit 3e1eec8

Please sign in to comment.