fix(viewer): rendu unifié type markdown pour fichiers texte/JSON/CSV + autofocus arborescence apres import (#89)
This commit is contained in:
+10
-1
@@ -11,7 +11,7 @@
|
||||
import { api } from './auth.js';
|
||||
import { t } from './i18n.js';
|
||||
import { showToast } from './ui.js';
|
||||
import { refreshSidebarTreePreservingState } from './sidebar.js';
|
||||
import { refreshSidebarTreePreservingState, focusPathInSidebar } from './sidebar.js';
|
||||
|
||||
/**
|
||||
* Recursively read all FileSystemEntry items (files and directories) from DataTransferItemList.
|
||||
@@ -209,6 +209,15 @@ export async function handleVaultDropUpload(vault, targetDir, items) {
|
||||
showToast(`${t('upload.error') || 'Upload failed'}: ${errDetail}`, 'error');
|
||||
}
|
||||
await refreshSidebarTreePreservingState();
|
||||
if (chosenTargetDir) {
|
||||
try {
|
||||
await focusPathInSidebar(chosenVault, chosenTargetDir, { alignToTop: true, expandTarget: true });
|
||||
} catch (_) { /* ignore */ }
|
||||
} else if (res?.uploaded?.[0]) {
|
||||
try {
|
||||
await focusPathInSidebar(chosenVault, res.uploaded[0], { alignToTop: true, expandTarget: true });
|
||||
} catch (_) { /* ignore */ }
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Batch upload error:', err);
|
||||
showToast(`${t('upload.error') || 'Upload failed'}: ${err.message || err}`, 'error');
|
||||
|
||||
Reference in New Issue
Block a user