From a1f663897ee6e5c7191084ad6309d42cf4d5b629 Mon Sep 17 00:00:00 2001 From: James Lucas Date: Wed, 4 Oct 2023 13:21:18 +1100 Subject: [PATCH] fix: correctly show sort buttons in non-bootstrap mode. Use helpers.toggleHighlight when sorting elements rather than a custom animation --- src/js/form-builder.js | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/src/js/form-builder.js b/src/js/form-builder.js index 5deabca69..11b4893b6 100644 --- a/src/js/form-builder.js +++ b/src/js/form-builder.js @@ -1073,18 +1073,20 @@ function FormBuilder(opts, element, $) { }), ) } else { - m('a', null, { - type: 'sort', - id: data.lastID + '-sort-higher', - className: `sort-button sort-button-higher btn ${css_prefix_text}sort-higher`, - title: 'Move Higher', - }), + fieldButtons.push( + m('a', null, { + type: 'sort', + id: data.lastID + '-sort-higher', + className: `sort-button sort-button-higher btn ${css_prefix_text}sort-higher`, + title: 'Move Higher', + }), m('a', null, { type: 'sort', id: data.lastID + '-sort-lower', className: `sort-button sort-button-lower btn ${css_prefix_text}sort-lower`, title: 'Move Lower', }) + ) } if (disabledFieldButtons && Array.isArray(disabledFieldButtons)) { @@ -2331,24 +2333,7 @@ function FormBuilder(opts, element, $) { } } - if (swap.length) { - //Animate the flashing of the background and border of the element was moved - currentItem.css({ - 'border-color': '#66afe9', - 'outline': 0, - 'box-shadow': 'inset 0 1px 1px rgba(0,0,0,.1),0 0 8px rgba(102,175,233,.6)', - 'background-color': '#b7d6f5', - }).delay('fast') - .queue(function(next) { - $(this).css({ - 'border-color': '', - 'outline': '', - 'box-shadow': '', - 'background-color': '' - }) - next() - }) - } + h.toggleHighlight(currentItem) }) // Update button style selection