diff --git a/Changelog.md b/Changelog.md index 521f534f7..77b01824f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -25,6 +25,7 @@ - 修复更新时加载进度条异常 - 升级内核失败导致内核不可用问题 - 修复 macOS 在安装和卸载服务时提示与操作不匹配 +- 修复菜单排序模式拖拽异常
✨ 新增功能 diff --git a/src/components/layout/layout-item.tsx b/src/components/layout/layout-item.tsx index fdc2e1539..6c6d23828 100644 --- a/src/components/layout/layout-item.tsx +++ b/src/components/layout/layout-item.tsx @@ -37,9 +37,14 @@ export const LayoutItem = (props: Props) => { const match = useMatch({ path: resolved.pathname, end: true }); const navigate = useNavigate(); - const { setNodeRef, attributes, listeners, style, isDragging } = + const { setNodeRef, attributes, listeners, style, isDragging, disabled } = sortable ?? {}; + const draggable = Boolean(sortable) && !disabled; + const dragHandleProps = draggable + ? { ...(attributes ?? {}), ...(listeners ?? {}) } + : undefined; + return ( { > { paddingLeft: 1, paddingRight: 1, marginRight: 1.25, - cursor: "pointer", + cursor: draggable ? "grab" : "pointer", + "&:active": draggable ? { cursor: "grabbing" } : {}, "& .MuiListItemText-primary": { color: "text.primary", fontWeight: "700", @@ -84,20 +91,14 @@ export const LayoutItem = (props: Props) => { sx={{ color: "text.primary", marginLeft: "6px", - cursor: sortable && !sortable.disabled ? "grab" : "inherit", + cursor: draggable ? "grab" : "inherit", }} - {...(attributes ?? {})} - {...(listeners ?? {})} > {icon[0]} )} {menu_icon === "colorful" && ( - + {icon[1]} )}