mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-20 16:43:53 +01:00
Prevent dragging folders into itself
This commit is contained in:
@@ -329,6 +329,11 @@ export function Sidebar({ className }: Props) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Block dragging folder into itself
|
||||
if (hoveredTree.item.id === itemId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const parentTree = treeParentMap[itemId] ?? null;
|
||||
const index = parentTree?.children.findIndex((n) => n.item.id === itemId) ?? -1;
|
||||
const child = parentTree?.children[index ?? -1];
|
||||
@@ -647,7 +652,7 @@ const SidebarItem = forwardRef(function SidebarItem(
|
||||
|
||||
return (
|
||||
<li ref={ref} draggable={draggable}>
|
||||
<div className={classNames(className, 'block relative group/item px-2 pb-0.5')}>
|
||||
<div className={classNames(className, 'block relative group/item px-1.5 pb-0.5')}>
|
||||
<ContextMenu
|
||||
show={showContextMenu}
|
||||
items={
|
||||
@@ -760,7 +765,7 @@ const SidebarItem = forwardRef(function SidebarItem(
|
||||
size="sm"
|
||||
icon="chevronRight"
|
||||
className={classNames(
|
||||
'-ml-0.5 transition-transform opacity-50',
|
||||
'transition-transform opacity-50',
|
||||
!isCollapsed(itemId) && 'transform rotate-90',
|
||||
)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user