Skip to content

Commit

Permalink
fix: Don't allow rows moved via the keyboard in the enhancedBootstrap…
Browse files Browse the repository at this point in the history
… feature to swap with prepended or appended fields
  • Loading branch information
lucasnetau committed Oct 3, 2023
1 parent f7fa676 commit 5af6feb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/js/form-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2034,23 +2034,19 @@ function FormBuilder(opts, element, $) {
})

function moveFieldUp(rowWrapper) {
const previousRowSibling = rowWrapper.prevAll().not(tmpRowPlaceholderClassSelector).first()
const previousRowSibling = rowWrapper.prevAll().not(tmpRowPlaceholderClassSelector).not('.form-prepend').first()
if (previousRowSibling.length) {
$(gridModeTargetField.parent().parent()).swapWith(previousRowSibling)
} else {
return
h.toggleHighlight(gridModeTargetField)
}
h.toggleHighlight(gridModeTargetField)
}

function moveFieldDown(rowWrapper) {
const nextRowSibling = rowWrapper.nextAll().not(invisibleRowPlaceholderClassSelector).first()
const nextRowSibling = rowWrapper.nextAll().not(invisibleRowPlaceholderClassSelector).not('.form-append').first()
if (nextRowSibling.length) {
$(gridModeTargetField.parent().parent()).swapWith(nextRowSibling)
} else {
return
h.toggleHighlight(gridModeTargetField)
}
h.toggleHighlight(gridModeTargetField)
}

function moveFieldLeft() {
Expand Down

0 comments on commit 5af6feb

Please sign in to comment.