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
b6b0fff5d6
commit
fbeee59e99
2 changed files with 21 additions and 0 deletions
|
|
@ -1514,6 +1514,10 @@
|
|||
};
|
||||
|
||||
// ── File creation ────────────────────────────────────────────────────
|
||||
const startNewFileIn = async (path: string) => {
|
||||
if (await loadDir(path)) await startNewFile();
|
||||
};
|
||||
|
||||
const startNewFile = async () => {
|
||||
if (!currentWritable) return;
|
||||
creatingFile = true;
|
||||
|
|
@ -2556,6 +2560,7 @@
|
|||
: undefined}
|
||||
onDownload={downloadFile}
|
||||
onNewFolder={startNewFolderIn}
|
||||
onNewFile={startNewFileIn}
|
||||
onDelete={requestDelete}
|
||||
onMove={handleMovePaths}
|
||||
onRename={handleRename}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
export let onOpen: (entry: FileEntry) => void = () => {};
|
||||
export let onNewFolder: ((path: string) => void) | undefined = undefined;
|
||||
export let onNewFile: ((path: string) => void) | undefined = undefined;
|
||||
export let onSelectForComparison: (() => void) | undefined = undefined;
|
||||
export let onCompareWithSelected: (() => void) | undefined = undefined;
|
||||
export let comparisonPath: string | null = null;
|
||||
|
|
@ -406,6 +407,21 @@
|
|||
<div class="flex items-center">{$i18n.t('New Folder')}</div>
|
||||
</button>
|
||||
{/if}
|
||||
{#if entry.type === 'directory' && onNewFile}
|
||||
<button
|
||||
type="button"
|
||||
class="{menuItemClass} disabled:opacity-40 disabled:hover:bg-transparent"
|
||||
disabled={!writable}
|
||||
on:click|stopPropagation={() => {
|
||||
if (!writable) return;
|
||||
menuOpen = false;
|
||||
onNewFile?.(directoryPath);
|
||||
}}
|
||||
>
|
||||
<Icon name="plus" size={12} strokeWidth={1.4} />
|
||||
<div class="flex items-center">{$i18n.t('New File')}</div>
|
||||
</button>
|
||||
{/if}
|
||||
{#if entry.type === 'file' && onSelectForComparison}
|
||||
<button
|
||||
type="button"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue