Skip to content

Commit

Permalink
fix: when sorting stage items don't allow the placeholder to go befor…
Browse files Browse the repository at this point in the history
…e a prepended and after an appended item
  • Loading branch information
lucasnetau committed Oct 13, 2023
1 parent edd5500 commit 6da23a2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/js/form-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ function FormBuilder(opts, element, $) {
beforeStop: (evt, ui) => h.beforeStop.call(h, evt, ui),
start: (evt, ui) => h.startMoving.call(h, evt, ui),
stop: (evt, ui) => h.stopMoving.call(h, evt, ui),
change: function(event, ui) {
if (opts.prepend && ui.placeholder.index() < 1) {
$('li.form-prepend').after(ui.placeholder)
} else if (opts.append && ui.placeholder.index() >= ($stage.children('li').length - 1)) {
$('li.form-append').before(ui.placeholder)
}
},
cancel: ['input', 'select', 'textarea', '.disabled-field', '.form-elements', '.btn', 'button', '.is-locked'].join(
', ',
),
Expand Down

0 comments on commit 6da23a2

Please sign in to comment.