|
1 | 1 | <script lang="ts">
|
2 | 2 | import type { FolderNode, FileTree, FileTreeNode } from "$lib/tree.svelte";
|
3 |
| - import { |
4 |
| - ClipboardPasteIcon, |
5 |
| - CopyIcon, |
6 |
| - PenIcon, |
7 |
| - PlusIcon, |
8 |
| - ScissorsIcon, |
9 |
| - TrashIcon, |
10 |
| - UploadIcon, |
11 |
| - } from "@lucide/svelte"; |
12 | 3 | import { ContextMenu } from "bits-ui";
|
13 | 4 | import type { Snippet } from "svelte";
|
14 | 5 | import type { PasteOperation, TreeItemState } from "svelte-file-tree";
|
|
156 | 147 | </script>
|
157 | 148 |
|
158 | 149 | <ContextMenu.Root bind:open={open, handleOpenChange}>
|
159 |
| - <ContextMenu.Trigger |
160 |
| - class="grow overflow-y-auto rounded px-(--tree-inline-padding) py-2" |
161 |
| - oncontextmenu={handleTriggerContextMenu} |
162 |
| - > |
| 150 | + <ContextMenu.Trigger class="grow overflow-y-auto" oncontextmenu={handleTriggerContextMenu}> |
163 | 151 | {@render children()}
|
164 | 152 | </ContextMenu.Trigger>
|
165 | 153 |
|
166 | 154 | <ContextMenu.Portal>
|
167 | 155 | <ContextMenu.Content
|
168 |
| - class="z-50 w-[200px] rounded-xl border border-gray-300 bg-gray-50 p-2 shadow focus-visible:outline-none" |
| 156 | + class="z-50 w-60 rounded-md border border-gray-300 bg-gray-50 p-2 shadow focus-visible:outline-none" |
169 | 157 | >
|
170 | 158 | {#if showArgs?.type === "item"}
|
171 | 159 | {@const item = showArgs.item()}
|
172 | 160 | <ContextMenuItem onSelect={() => onRename(item)}>
|
173 |
| - <PenIcon role="presentation" size={20} /> |
174 | 161 | <span>Rename</span>
|
| 162 | + <kbd>F2</kbd> |
175 | 163 | </ContextMenuItem>
|
176 | 164 |
|
177 | 165 | <ContextMenuItem onSelect={() => onCopy(item, "copy")}>
|
178 |
| - <CopyIcon role="presentation" size={20} /> |
179 | 166 | <span>Copy</span>
|
| 167 | + <kbd> |
| 168 | + <kdb>⌘</kdb> + <kdb>C</kdb> |
| 169 | + </kbd> |
180 | 170 | </ContextMenuItem>
|
181 | 171 |
|
182 | 172 | <ContextMenuItem onSelect={() => onCopy(item, "cut")}>
|
183 |
| - <ScissorsIcon role="presentation" size={20} /> |
184 | 173 | <span>Cut</span>
|
| 174 | + <kbd> |
| 175 | + <kdb>⌘</kdb> + <kdb>X</kdb> |
| 176 | + </kbd> |
185 | 177 | </ContextMenuItem>
|
186 | 178 |
|
187 | 179 | <ContextMenuItem onSelect={() => onPaste(item)}>
|
188 |
| - <ClipboardPasteIcon role="presentation" size={20} /> |
189 | 180 | <span>Paste</span>
|
| 181 | + <kbd> |
| 182 | + <kdb>⌘</kdb> + <kdb>V</kdb> |
| 183 | + </kbd> |
190 | 184 | </ContextMenuItem>
|
191 | 185 |
|
192 | 186 | <ContextMenuItem onSelect={() => onRemove(item)}>
|
193 |
| - <TrashIcon role="presentation" size={20} /> |
194 | 187 | <span>Delete</span>
|
| 188 | + <kbd>⌫</kbd> |
195 | 189 | </ContextMenuItem>
|
196 | 190 | {/if}
|
197 | 191 |
|
198 | 192 | {@const isFolder = showArgs?.type === "item" && showArgs.item().node.type === "folder"}
|
199 | 193 | {#if showArgs?.type === "tree" || isFolder}
|
200 | 194 | <ContextMenuItem onSelect={handleCreateFolder}>
|
201 |
| - <PlusIcon role="presentation" size={20} /> |
202 | 195 | <span>New Folder</span>
|
203 | 196 | </ContextMenuItem>
|
204 | 197 |
|
205 | 198 | <ContextMenuItem onSelect={handleUploadFiles}>
|
206 |
| - <UploadIcon role="presentation" size={20} /> |
207 | 199 | <span>Upload Files</span>
|
208 | 200 | </ContextMenuItem>
|
209 | 201 | {/if}
|
|
0 commit comments