This commit is contained in:
Timothy Jaeryang Baek
2026-03-01 02:29:37 -06:00
parent 234306ff57
commit 3d535db304
3 changed files with 123 additions and 3 deletions
+12
View File
@@ -441,6 +441,18 @@
{filePdfData}
{fileContent}
onDownload={() => downloadFile(selectedFile)}
onSave={async (content) => {
const terminal = selectedTerminal;
if (!terminal || !selectedFile) return;
const fileName = selectedFile.split('/').pop() ?? 'file';
const dir = selectedFile.substring(0, selectedFile.lastIndexOf('/') + 1) || '/';
const file = new File([content], fileName, { type: 'text/plain' });
const result = await uploadToTerminal(terminal.url, terminal.key, dir, file);
toast[result ? 'success' : 'error'](
$i18n.t(result ? 'File saved' : 'Failed to save file')
);
if (result) fileContent = content;
}}
/>
{:else}
{#if uploading}