(folderParam, options = {})
| 6047 | window.updateRowHighlight = updateRowHighlight; |
| 6048 | |
| 6049 | export async function loadFileList(folderParam, options = {}) { |
| 6050 | clearInlineRenameState({ restore: false }); |
| 6051 | await initOnlyOfficeCaps(); |
| 6052 | hideHoverPreview(); |
| 6053 | const pane = normalizePaneKey(options.pane || window.activePane); |
| 6054 | const reqId = ++__fileListReqSeq[pane]; // latest call wins |
| 6055 | const folderOnly = |
| 6056 | window.userFolderOnly === true || |
| 6057 | localStorage.getItem("folderOnly") === "true"; |
| 6058 | const username = (localStorage.getItem("username") || "").trim(); |
| 6059 | let paneSourceId = getPaneSourceId(pane); |
| 6060 | const paneState = getPaneState(pane); |
| 6061 | const paneFolder = (paneState && paneState.sourceId === paneSourceId && typeof paneState.currentFolder === 'string') |
| 6062 | ? paneState.currentFolder.trim() |
| 6063 | : readStoredPaneFolder(pane, paneSourceId); |
| 6064 | const lastOpenedFolder = getLastOpenedFolder(paneSourceId); |
| 6065 | const { skipFallback } = options || {}; |
| 6066 | const sourceParam = paneSourceId ? `&sourceId=${encodeURIComponent(paneSourceId)}` : ''; |
| 6067 | const isFtp = isFtpSource(paneSourceId); |
| 6068 | const shouldFetchFolders = window.showFoldersInList !== false || window.showInlineFolders !== false; |
| 6069 | const includeContent = window.advancedSearchEnabled === true || options.includeContent === true; |
| 6070 | const useServerPaging = shouldUseServerFilePagingForRequest(options); |
| 6071 | let requestedCursor = (options && Object.prototype.hasOwnProperty.call(options, 'cursor')) |
| 6072 | ? String(options.cursor || '') |
| 6073 | : null; |
| 6074 | const hadExplicitFolderParam = folderParam !== undefined && folderParam !== null && String(folderParam).trim() !== ''; |
| 6075 | const prevPaneFolder = (paneState && typeof paneState.currentFolder === 'string') |
| 6076 | ? paneState.currentFolder.trim() |
| 6077 | : ''; |
| 6078 | |
| 6079 | let folder = folderParam || paneFolder || lastOpenedFolder || (paneSourceId ? "root" : (window.currentFolder || "root")); |
| 6080 | const isActivePane = pane === normalizePaneKey(window.activePane); |
| 6081 | if (isActivePane && folder) { |
| 6082 | window.currentFolder = folder; |
| 6083 | updateBreadcrumbTitle(folder); |
| 6084 | } |
| 6085 | if (folderOnly && (!folder || folder === "root") && username) { |
| 6086 | folder = username; |
| 6087 | window.currentFolder = folder; |
| 6088 | setLastOpenedFolder(folder, paneSourceId); |
| 6089 | updateBreadcrumbTitle(folder); |
| 6090 | } |
| 6091 | const prevFolderKey = normalizeFolderPath(prevPaneFolder || paneFolder || ''); |
| 6092 | const nextFolderKey = normalizeFolderPath(folder || ''); |
| 6093 | const folderChangedByExplicitLoad = hadExplicitFolderParam && prevFolderKey !== nextFolderKey; |
| 6094 | if (folderChangedByExplicitLoad) { |
| 6095 | resetPagingForFolderNavigation(pane); |
| 6096 | // Ignore any stale cursor when changing folders through a direct load call. |
| 6097 | requestedCursor = null; |
| 6098 | } |
| 6099 | savePaneState(pane, { currentFolder: folder }); |
| 6100 | const subfoldersMatch = |
| 6101 | String(window.currentSubfoldersSourceId || '') === String(paneSourceId || '') && |
| 6102 | String(window.currentSubfoldersFolder || '') === String(folder || ''); |
| 6103 | if (!subfoldersMatch) { |
| 6104 | window.currentSubfolders = []; |
| 6105 | window.currentSubfoldersSourceId = String(paneSourceId || ''); |
| 6106 | window.currentSubfoldersFolder = String(folder || ''); |
no test coverage detected