mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-28 06:22:33 +00:00
refac
This commit is contained in:
parent
c7cac65f45
commit
b6b0fff5d6
2 changed files with 22 additions and 0 deletions
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue