From a44ef6e77d4f7d4001083a9228fa961af0b22333 Mon Sep 17 00:00:00 2001 From: James Lucas Date: Thu, 26 Oct 2023 11:31:31 +1100 Subject: [PATCH 1/3] fix: prevent togging the edit field if double-clicking within a textarea. Additionally, use the property isContentEditable to check if the element double-clicked is a descendant of a contenteditable field (eg a paragraph withing a div[contenteditable]) --- src/js/form-builder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/form-builder.js b/src/js/form-builder.js index 4494915bf..ab0a0006f 100644 --- a/src/js/form-builder.js +++ b/src/js/form-builder.js @@ -1667,7 +1667,7 @@ function FormBuilder(opts, element, $) { }) $stage.on('dblclick', 'li.form-field', e => { - if (['select', 'input', 'label'].includes(e.target.tagName.toLowerCase()) || e.target.contentEditable === 'true') { + if (['select', 'input', 'label','textarea',].includes(e.target.tagName.toLowerCase()) || e.target.isContentEditable === true) { return } e.stopPropagation() From db27e067c849bceb40e60da6acdf8b395ab8f0eb Mon Sep 17 00:00:00 2001 From: James Lucas Date: Thu, 26 Oct 2023 11:34:38 +1100 Subject: [PATCH 2/3] fix: Don't pull grid classes from SVG elements, The SVG className property is a SVGAnimatedString not a string. Controls like textarea.quill have SVG graphics in their element list. --- src/js/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/utils.js b/src/js/utils.js index 4b77bd892..fc4cf5df8 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -663,7 +663,7 @@ export const bootstrapColumnRegex = /^col-(xs|sm|md|lg)-([^\s]+)/ * @returns {string[]} */ export const getAllGridRelatedClasses = className => { - return className.split(' ').filter(x => bootstrapColumnRegex.test(x) || x.startsWith('row-')) + return (typeof className === 'string') ? className.split(' ').filter(x => bootstrapColumnRegex.test(x) || x.startsWith('row-')) : [] } /** From 533ae8020cbdc07689fc2f8129562d844526a0ef Mon Sep 17 00:00:00 2001 From: James Lucas Date: Thu, 26 Oct 2023 11:37:10 +1100 Subject: [PATCH 3/3] fix: strip form-control from the quill container div if it is set, this class is incompatible with the quill control --- src/js/control/textarea.quill.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/js/control/textarea.quill.js b/src/js/control/textarea.quill.js index a9ac571d4..f63bd3722 100644 --- a/src/js/control/textarea.quill.js +++ b/src/js/control/textarea.quill.js @@ -49,6 +49,9 @@ export default class controlQuill extends controlTextarea { //Textareas do not have an attribute 'type' delete attrs['type'] this.field = this.markup('div', null, attrs) + if (this.field.classList.contains('form-control')) { + this.field.classList.remove('form-control') + } return this.field }