This commit is contained in:
Timothy Jaeryang Baek 2026-10-21 11:45:33 +09:00
parent c7cac65f45
commit b6b0fff5d6
2 changed files with 22 additions and 0 deletions

View file

@ -1006,6 +1006,7 @@
treeCache = new Map(treeCache).set(directory, entries);
saveTreeState();
}
return result !== null;
};
const fetchExpandedDir = async (path: string) => {
@ -1478,6 +1479,10 @@
};
// ── Folder creation ──────────────────────────────────────────────────
const startNewFolderIn = async (path: string) => {
if (await loadDir(path)) await startNewFolder();
};
const startNewFolder = async () => {
if (!currentWritable) return;
creatingFolder = true;
@ -2550,6 +2555,7 @@
}
: undefined}
onDownload={downloadFile}
onNewFolder={startNewFolderIn}
onDelete={requestDelete}
onMove={handleMovePaths}
onRename={handleRename}

View file

@ -24,6 +24,7 @@
export let terminalKey: string = '';
export let onOpen: (entry: FileEntry) => void = () => {};
export let onNewFolder: ((path: string) => void) | undefined = undefined;
export let onSelectForComparison: (() => void) | undefined = undefined;
export let onCompareWithSelected: (() => void) | undefined = undefined;
export let comparisonPath: string | null = null;
@ -390,6 +391,21 @@
</div>
</button>
{/if}
{#if entry.type === 'directory' && onNewFolder}
<button
type="button"
class="{menuItemClass} disabled:opacity-40 disabled:hover:bg-transparent"
disabled={!writable}
on:click|stopPropagation={() => {
if (!writable) return;
menuOpen = false;
onNewFolder?.(directoryPath);
}}
>
<Icon name="folder" size={12} strokeWidth={1.4} />
<div class="flex items-center">{$i18n.t('New Folder')}</div>
</button>
{/if}
{#if entry.type === 'file' && onSelectForComparison}
<button
type="button"