Skip to content
Merged
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -153,45 +153,51 @@ coreshop.object.objectMultihref = Class.create(pimcore.object.tags.manyToManyObj
return this.component.getEl().dom;
}.bind(this),
onNodeOver: function (overHtmlNode, ddSource, e, data) {
var record = data.records[0];
var data = record.data;
var fromTree = this.isFromTree(ddSource);

if (data.elementType == 'object' && this.dndAllowed(data, fromTree)) {
return Ext.dd.DropZone.prototype.dropAllowed;
} else {
return Ext.dd.DropZone.prototype.dropNotAllowed;
// Check if any of the records can be dropped
for (var i = 0; i < data.records.length; i++) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Expected a for-of loop instead of a for loop with this simple iteration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use for-of loop in dbfac39.

var recordData = data.records[i].data;
if (recordData.elementType === 'object' && this.dndAllowed(recordData, fromTree)) {
return Ext.dd.DropZone.prototype.dropAllowed;
}
}

return Ext.dd.DropZone.prototype.dropNotAllowed;
}.bind(this),
onNodeDrop: function (target, ddSource, e, data) {
var record = data.records[0];
var data = record.data;
var fromTree = this.isFromTree(ddSource);

// check if data is a treenode, if not allow drop because of the reordering
if (!fromTree) {
return true;
}

if (data.elementType != 'object') {
return false;
}
var addedAny = false;

if (this.dndAllowed(data, fromTree)) {
var initData = {
id: data.id,
path: data.path,
type: data.className
};
// Process all records in the drag selection
for (var i = 0; i < data.records.length; i++) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Expected a for-of loop instead of a for loop with this simple iteration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use for-of loop in dbfac39.

var recordData = data.records[i].data;

if (recordData.elementType !== 'object') {
continue;
}

if (!this.objectAlreadyExists(initData.id)) {
this.store.add(initData);
return true;
if (this.dndAllowed(recordData, fromTree)) {
var initData = {
id: recordData.id,
path: recordData.path,
type: recordData.className
};

if (!this.objectAlreadyExists(initData.id)) {
this.store.add(initData);
addedAny = true;
}
}
}

return false;
return addedAny;
}.bind(this)
});
}.bind(this));
Expand Down