Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix Objectfield Move item #657

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions src/js/fields/basic/ObjectField.js
Original file line number Diff line number Diff line change
Expand Up @@ -1976,23 +1976,14 @@
var onComplete = function()
{
// swap order in children
var tempChildren = [];
for (var i = 0; i < self.children.length; i++)
{
if (i === sourceIndex)
{
tempChildren[i] = self.children[targetIndex];
}
else if (i === targetIndex)
{
tempChildren[i] = self.children[sourceIndex];
}
else
{
tempChildren[i] = self.children[i];
}
var adjustedTargetIndex = targetIndex;
if (sourceIndex < targetIndex) {
adjustedTargetIndex--;
}
self.children = tempChildren;

// splice out child
var child = self.children.splice(sourceIndex, 1)[0];
self.children.splice(adjustedTargetIndex, 0, child);

// swap order in DOM
tempSourceMarker.replaceWith(targetContainer);
Expand Down