Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dsamojlenko committed May 2, 2024
1 parent 0b5e906 commit 7c14bb6
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,20 @@ const ControlledTree: ForwardRefRenderFunction<unknown, TreeDataProviderProps> =
const folderItemsCount = items.filter((item) => item.isFolder).length;
const nonFolderItemsCount = items.filter((item) => !item.isFolder).length;

// can't drag mixed item types
// Can't drag mixed item types
if (folderItemsCount > 0 && nonFolderItemsCount > 0) {
return false;
}

// if any of the selected items is a folder, disallow dropping on a folder
// If any of the selected items is a folder, disallow dropping on a folder
if (folderItemsCount >= 1) {
const { parentItem } = target as DraggingPositionBetweenItems;
if (items[0].isFolder && parentItem !== "root") {
return false;
}
}

// if any of the items is not a folder, disallow dropping on root
// If any of the items is not a folder, disallow dropping on root
if (nonFolderItemsCount >= 1) {
if (target.depth === 0) {
return false;
Expand Down

0 comments on commit 7c14bb6

Please sign in to comment.