mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-18 14:59:42 +02:00
Fix sidebar drag-n-drop
This commit is contained in:
@@ -242,6 +242,7 @@ type SidebarItemProps = {
|
|||||||
useProminentStyles?: boolean;
|
useProminentStyles?: boolean;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
onSelect: (requestId: string) => void;
|
onSelect: (requestId: string) => void;
|
||||||
|
draggable?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const _SidebarItem = forwardRef(function SidebarItem(
|
const _SidebarItem = forwardRef(function SidebarItem(
|
||||||
@@ -300,16 +301,13 @@ const _SidebarItem = forwardRef(function SidebarItem(
|
|||||||
return (
|
return (
|
||||||
<li ref={ref} className={classnames(className, 'block group/item px-2 pb-0.5')}>
|
<li ref={ref} className={classnames(className, 'block group/item px-2 pb-0.5')}>
|
||||||
<button
|
<button
|
||||||
tabIndex={-1}
|
// tabIndex={-1} // Will prevent drag-n-drop
|
||||||
color="custom"
|
|
||||||
onClick={handleSelect}
|
onClick={handleSelect}
|
||||||
disabled={editing}
|
disabled={editing}
|
||||||
draggable={false} // Item should drag, not the link
|
|
||||||
onDoubleClick={handleStartEditing}
|
onDoubleClick={handleStartEditing}
|
||||||
data-active={isActive}
|
data-active={isActive}
|
||||||
data-selected={selected}
|
data-selected={selected}
|
||||||
className={classnames(
|
className={classnames(
|
||||||
// 'outline-none',
|
|
||||||
'w-full flex items-center text-sm h-xs px-2 rounded-md transition-colors',
|
'w-full flex items-center text-sm h-xs px-2 rounded-md transition-colors',
|
||||||
editing && 'ring-1 focus-within:ring-focus',
|
editing && 'ring-1 focus-within:ring-focus',
|
||||||
isActive && 'bg-highlight text-gray-800',
|
isActive && 'bg-highlight text-gray-800',
|
||||||
@@ -396,6 +394,7 @@ const DraggableSidebarItem = memo(function DraggableSidebarItem({
|
|||||||
return (
|
return (
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
draggable
|
||||||
className={classnames(isDragging && 'opacity-20')}
|
className={classnames(isDragging && 'opacity-20')}
|
||||||
requestName={requestName}
|
requestName={requestName}
|
||||||
requestId={requestId}
|
requestId={requestId}
|
||||||
|
|||||||
Reference in New Issue
Block a user