mirror of https://github.com/langgenius/dify.git
fix(skill): remove non-functional copy menu item from file tree context menu
This commit is contained in:
parent
000bdf6bc0
commit
3c7f641f60
|
|
@ -9,7 +9,6 @@ import {
|
|||
RiDeleteBinLine,
|
||||
RiEdit2Line,
|
||||
RiFileAddLine,
|
||||
RiFileCopyLine,
|
||||
RiFolderAddLine,
|
||||
RiFolderUploadLine,
|
||||
RiScissorsLine,
|
||||
|
|
@ -31,7 +30,6 @@ export const MENU_CONTAINER_STYLES = [
|
|||
'bg-components-panel-bg-blur p-1 shadow-lg backdrop-blur-[5px]',
|
||||
] as const
|
||||
|
||||
const KBD_COPY = ['ctrl', 'c'] as const
|
||||
const KBD_CUT = ['ctrl', 'x'] as const
|
||||
const KBD_PASTE = ['ctrl', 'v'] as const
|
||||
|
||||
|
|
@ -78,14 +76,6 @@ const NodeMenu: FC<NodeMenuProps> = ({
|
|||
|
||||
const currentNodeId = node?.data.id ?? nodeId
|
||||
|
||||
const handleCopy = useCallback(() => {
|
||||
const ids = selectedNodeIds.size > 0 ? [...selectedNodeIds] : (currentNodeId ? [currentNodeId] : [])
|
||||
if (ids.length > 0) {
|
||||
storeApi.getState().copyNodes(ids)
|
||||
onClose()
|
||||
}
|
||||
}, [currentNodeId, onClose, selectedNodeIds, storeApi])
|
||||
|
||||
const handleCut = useCallback(() => {
|
||||
const ids = selectedNodeIds.size > 0 ? [...selectedNodeIds] : (currentNodeId ? [currentNodeId] : [])
|
||||
if (ids.length > 0) {
|
||||
|
|
@ -182,13 +172,6 @@ const NodeMenu: FC<NodeMenuProps> = ({
|
|||
onClick={handleCut}
|
||||
disabled={isLoading}
|
||||
/>
|
||||
<MenuItem
|
||||
icon={RiFileCopyLine}
|
||||
label={t('skillSidebar.menu.copy')}
|
||||
kbd={KBD_COPY}
|
||||
onClick={handleCopy}
|
||||
disabled={isLoading}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,12 +100,6 @@ export function usePasteOperation({
|
|||
isPastingRef.current = false
|
||||
}
|
||||
}
|
||||
else {
|
||||
Toast.notify({
|
||||
type: 'info',
|
||||
message: t('skillSidebar.menu.copyNotSupported'),
|
||||
})
|
||||
}
|
||||
}, [appId, moveNode, storeApi, t, treeData?.children, treeRef])
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -46,16 +46,6 @@ export function useSkillShortcuts({
|
|||
return tree.selectedNodes.map(n => n.id)
|
||||
}, [treeRef])
|
||||
|
||||
useKeyPress(`${getKeyboardKeyCodeBySystem('ctrl')}.c`, (e) => {
|
||||
if (shouldHandle(e)) {
|
||||
const nodeIds = getSelectedNodeIds()
|
||||
if (nodeIds.length > 0) {
|
||||
e.preventDefault()
|
||||
storeApi.getState().copyNodes(nodeIds)
|
||||
}
|
||||
}
|
||||
}, { exactMatch: true, useCapture: true })
|
||||
|
||||
useKeyPress(`${getKeyboardKeyCodeBySystem('ctrl')}.x`, (e) => {
|
||||
if (shouldHandle(e)) {
|
||||
const nodeIds = getSelectedNodeIds()
|
||||
|
|
|
|||
|
|
@ -11,12 +11,6 @@ export const createClipboardSlice: StateCreator<
|
|||
> = (set, get) => ({
|
||||
clipboard: null,
|
||||
|
||||
copyNodes: (nodeIds) => {
|
||||
if (nodeIds.length === 0)
|
||||
return
|
||||
set({ clipboard: { operation: 'copy', nodeIds: new Set(nodeIds) } })
|
||||
},
|
||||
|
||||
cutNodes: (nodeIds) => {
|
||||
if (nodeIds.length === 0)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export type FileTreeSliceShape = {
|
|||
setFileTreeSearchTerm: (term: string) => void
|
||||
}
|
||||
|
||||
export type ClipboardOperation = 'copy' | 'cut'
|
||||
export type ClipboardOperation = 'cut'
|
||||
|
||||
export type ClipboardItem = {
|
||||
operation: ClipboardOperation
|
||||
|
|
@ -57,7 +57,6 @@ export type ClipboardItem = {
|
|||
|
||||
export type ClipboardSliceShape = {
|
||||
clipboard: ClipboardItem | null
|
||||
copyNodes: (nodeIds: string[]) => void
|
||||
cutNodes: (nodeIds: string[]) => void
|
||||
clearClipboard: () => void
|
||||
isCutNode: (nodeId: string) => boolean
|
||||
|
|
|
|||
|
|
@ -1088,8 +1088,6 @@
|
|||
"skillSidebar.loadError": "Failed to load files",
|
||||
"skillSidebar.menu.cannotMoveToDescendant": "Cannot move a folder into its descendant",
|
||||
"skillSidebar.menu.cannotMoveToSelf": "Cannot move a folder into itself",
|
||||
"skillSidebar.menu.copy": "Copy",
|
||||
"skillSidebar.menu.copyNotSupported": "Copy is not supported yet",
|
||||
"skillSidebar.menu.createError": "Failed to create item",
|
||||
"skillSidebar.menu.cut": "Cut",
|
||||
"skillSidebar.menu.delete": "Delete",
|
||||
|
|
|
|||
|
|
@ -1080,8 +1080,6 @@
|
|||
"skillSidebar.loadError": "加载文件失败",
|
||||
"skillSidebar.menu.cannotMoveToDescendant": "无法将文件夹移动到其子文件夹中",
|
||||
"skillSidebar.menu.cannotMoveToSelf": "无法将文件夹移动到自身内部",
|
||||
"skillSidebar.menu.copy": "复制",
|
||||
"skillSidebar.menu.copyNotSupported": "暂不支持复制功能",
|
||||
"skillSidebar.menu.createError": "创建失败",
|
||||
"skillSidebar.menu.cut": "剪切",
|
||||
"skillSidebar.menu.delete": "删除",
|
||||
|
|
|
|||
Loading…
Reference in New Issue