import { loadFileList } from './fileManager.js'; import { showToast } from './domUtils.js'; // ---------------------- // Helper functions // ---------------------- // Format folder name for display (for copy/move dropdown). export function formatFolderName(folder) { if (folder.indexOf("/") !== -1) { let parts = folder.split("/"); let indent = ""; for (let i = 1; i < parts.length; i++) { indent += "\u00A0\u00A0\u00A0\u00A0"; // 4 non-breaking spaces per level } return indent + parts[parts.length - 1]; } else { return folder; } } // Build a tree structure from a flat array of folder paths. function buildFolderTree(folders) { const tree = {}; folders.forEach(folderPath => { const parts = folderPath.split('/'); let current = tree; parts.forEach(part => { if (!current[part]) { current[part] = {}; } current = current[part]; }); }); return tree; } /** * Render the folder tree as nested