@setoelkahfi / svara / commits / da16ffc

feat: disabled root directory deletion

mellbacon committed May 30, 2023 at 13:42 UTC da16ffc9bec6b6045682e75eac7f4841b70ea048
2 files changed +4 -4
src/lib/FileTree.svelte
+2 -2
@@ -27,12 +27,12 @@
27 let contextmenuitems = [
28 {name: "Open in File Explorer", shortcut: "", action: async () => {await openInExplorer(path)}},
29 {name: "Copy", shortcut: "Ctrl + C", action: () => {console.warn("Feature not implemented yet.")}},
30 - {name: "Cut", shortcut: "Ctrl + X", action: () => {console.warn("Feature not implemented yet.")}},
30 + {name: "Cut", disabled: true, shortcut: "Ctrl + X", action: () => {console.warn("Feature not implemented yet.")}},
31 {name: "Paste", shortcut: "Ctrl + X", disabled: true, action: () => {console.warn("Feature not implemented yet.")}},
32 {name: "Copy Filename", shortcut: "", action: async () => {await clipboard.writeText(name)}},
33 {name: "Copy Absolute Path", shortcut: "", action: async () => {await clipboard.writeText(path)}},
34 {name: "Rename...", shortcut: "F2", disabled: true, action: () => {console.warn("Feature not implemented yet.")}},
35 - {name: "Delete", shortcut: "Delete", action: () => {console.warn("Feature not implemented yet.")}}
35 + {name: "Delete", disabled: true, shortcut: "Delete", action: () => {console.warn("Feature not implemented yet.")}}
36 ]
37 </script>
38
src/lib/FileTree/FileTreeList.svelte
+2 -2
@@ -33,12 +33,12 @@
33 let contextmenuitems = [
34 {name: "Open in File Explorer", shortcut: "", action: async () => {await openInExplorer(path)}},
35 {name: "Copy", shortcut: "Ctrl + C", action: () => {console.warn("Feature not implemented yet.")}},
36 - {name: "Cut", shortcut: "Ctrl + X", action: () => {console.warn("Feature not implemented yet.")}},
36 + {name: "Cut", disabled: isroot, shortcut: "Ctrl + X", action: () => {console.warn("Feature not implemented yet.")}},
37 {name: "Paste", shortcut: "Ctrl + X", disabled: true, action: () => {console.warn("Feature not implemented yet.")}},
38 {name: "Copy Filename", shortcut: "", action: async () => {await clipboard.writeText(name)}},
39 {name: "Copy Absolute Path", shortcut: "", action: async () => {await clipboard.writeText(path)}},
40 {name: "Rename...", shortcut: "F2", disabled: true, action: () => {console.warn("Feature not implemented yet.")}},
41 - {name: "Delete", shortcut: "Delete", action: async () => {await moveToTrash(path)}}
41 + {name: "Delete", disabled: isroot, shortcut: "Delete", action: async () => {await moveToTrash(path)}}
42 ]
43
44 function findNode(nodeid, tree = null) {