Skip to content

Commit

Permalink
Merge pull request #47 from michelegiorgi/development
Browse files Browse the repository at this point in the history
release v1.5.2
  • Loading branch information
michelegiorgi authored Jan 30, 2022
2 parents ccb126c + d46692f commit 1307b20
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 11 deletions.
9 changes: 6 additions & 3 deletions assets/scripts/public/fields/textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ export const fieldTextarea = (field) => {
lineHeight = parseInt(lineHeight.replace('px', ''))
textarea.value = savedValue
const minRows = textarea.rows
const maxLength = parseInt(textarea.getAttribute('maxlength'))
const counterHtml = `<div class="${ el('textarea', 'counter') }">${ savedValue.length } / ${ maxLength }</div>`
const maxLength = textarea.getAttribute('maxlength') ? ' / ' + parseInt(textarea.getAttribute('maxlength')) : ''
const counterHtml = maxLength ? `<div class="${ el('textarea', 'counter') }">${ savedValue.length + maxLength }</div>` : ''
textarea.insertAdjacentHTML('beforebegin', counterHtml)
textarea.addEventListener('input', (e) => {
textarea.previousElementSibling.innerText = textarea.value.length + ' / ' + maxLength
const counter = textarea.previousElementSibling
if(counter) {
counter.innerText = textarea.value.length + maxLength
}
textarea.rows = minRows
const newRows = Math.ceil((textarea.scrollHeight - baseScrollHeight) / lineHeight)
textarea.rows = minRows + newRows
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/public/modules/conditional.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export let initConditionalField = (form, field) => {
if(!field.hasAttribute('data-conditional')) return
let query = ''
const rule = JSON.parse(field.getAttribute('data-conditional'))
for (const index in rule) { query += ( index == 0 ? '' : ', ' ) + '[name=' + rule[index].field + ']' }
for (const index in rule) { query += ( index == 0 ? '' : ', ' ) + '[name="' + rule[index].field + '"]' }
if(query) {
checkCondition(form, field, rule)
const inputs = form.querySelectorAll(query)
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/public/modules/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export let inputKeypress = (input, field, conversational) => {

export let moveField = (input, field, direction='next', e, conversational=false) => {
let element = false
const visible = cl('field:not(' + cl('field', 'disabled') + ')')
const visible = cl('field:not(' + cl('field', '', 'disabled') + ')')
switch (direction) {
case 'next':
element = nextEl(field, visible)
Expand Down
4 changes: 2 additions & 2 deletions formality.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Plugin Name: Formality
* Plugin URI: https://formality.dev
* Description: Forms made simple (and cute). Designless, multistep, conversational, secure, all-in-one WordPress forms plugin.
* Version: 1.5.1
* Version: 1.5.2
* Author: Michele Giorgi
* Author URI: https://giorgi.io
* License: GPLv3
Expand Down Expand Up @@ -47,7 +47,7 @@
/**
* Currently plugin version.
*/
define('FORMALITY_VERSION', '1.5.1');
define('FORMALITY_VERSION', '1.5.2');
define('FORMALITY_PATH', plugin_dir_path( __FILE__ ));

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/class-formality.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Formality {
*/
public function __construct() {

$this->version = defined( 'FORMALITY_VERSION' ) ? FORMALITY_VERSION : '1.5.1';
$this->version = defined( 'FORMALITY_VERSION' ) ? FORMALITY_VERSION : '1.5.2';
$this->formality = 'formality';
$this->fse = class_exists('WP_Block_Editor_Context');

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": "Formality",
"version": "1.5.1",
"version": "1.5.2",
"author": "Michele Giorgi <[email protected]>",
"homepage": "https://giorgi.io",
"private": true,
Expand Down
11 changes: 10 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/michelegiorgi/
Tags: form, conversational, multistep, design form, gutenberg, block editor
Requires at least: 5.8
Tested up to: 5.9
Stable tag: 1.5.1
Stable tag: 1.5.2
Requires PHP: 7.2
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
Expand Down Expand Up @@ -61,6 +61,15 @@ You will find **Formality** menu in your WordPress admin screen.

== Changelog ==

= 1.5.2 =
Release Date: Jan 30th, 2022

* Fix conditional fields init ¹
* Remove characters counter from textarea field when max length is not defined
* Fix keyboard navigation with hidden fields

<small>¹ Thanks to @lukaskopenec for bug report</small>

= 1.5.1 =
Release Date: Jan 16th, 2022

Expand Down
2 changes: 1 addition & 1 deletion webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mix
.js('assets/scripts/public/index.js', 'scripts/formality-public.js')
.js('assets/scripts/editor/index.js', 'scripts/formality-editor.js')
.js('assets/scripts/admin/index.js', 'scripts/formality-admin.js')
.banner({ banner: 'Formality v1.5.1' });
.banner({ banner: 'Formality v1.5.2' });

mix
.copyWatched('assets/images/admin/**', 'dist/images/admin')
Expand Down

0 comments on commit 1307b20

Please sign in to comment.