From 236d7503133600d94c7b590e1056960e5f768f5e Mon Sep 17 00:00:00 2001 From: Christina Toegl <toegl@tugraz.at> Date: Mon, 13 Dec 2021 14:10:19 +0100 Subject: [PATCH] Fix breadcrumb bug with filtered recent files --- .../src/nextcloud-file-picker.js | 34 ++++--------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/packages/file-handling/src/nextcloud-file-picker.js b/packages/file-handling/src/nextcloud-file-picker.js index 2f3d34a7..33dd28be 100644 --- a/packages/file-handling/src/nextcloud-file-picker.js +++ b/packages/file-handling/src/nextcloud-file-picker.js @@ -590,6 +590,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { } } } + return result; } @@ -895,7 +896,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { this.directoryPath = ''; } - console.log("load recent files"); + console.log("load only my recent files"); this.selectAllButton = true; this.loading = true; this.statusText = i18n.t('nextcloud-file-picker.loadpath-nextcloud-file-picker', {name: this.nextcloudName}); @@ -1083,6 +1084,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { this.isPickerActive = true; this.isInFavorites = false; this.isInRecent = false; + this.isInFilteredRecent = false; this._(".nextcloud-content").scrollTop = 0; if (!this.activeDirectoryRights.includes("CK") && !this.activeDirectoryRights.includes("NV")) { this._("#download-button").setAttribute("disabled", "true"); @@ -1212,7 +1214,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { if (this.isInFavorites) { this.statusText = html`<span class="error"> ${ i18n.t('nextcloud-file-picker.error-save-to-favorites') } </span>`; return; - } else if (this.isInRecent) { //TODO verify + } else if (this.isInRecent || this.isInFilteredRecent) { //TODO verify this.statusText = html`<span class="error"> ${ i18n.t('nextcloud-file-picker.error-save-to-recent') } </span>`; return; } @@ -1869,7 +1871,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { }}" title="${i18n.t('nextcloud-file-picker.my-recent-files-title')}">${i18n.t('nextcloud-file-picker.my-recent-files-title')}</a></span>`; - } else { // case normal folders const directories = this.directoryPath.split('/'); if (directories[1] === "") { @@ -1936,10 +1937,8 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { menu.classList.toggle('hidden'); //sets hidden or removes it // computations for overflow - begin - //if (this.menuHeightBreadcrumb === -1) { - this.menuHeightBreadcrumb = menu.clientHeight; - // console.log("menuheight: ", this.menuHeightBreadcrumb); - //} + this.menuHeightBreadcrumb = menu.clientHeight; + // console.log("menuheight: ", this.menuHeightBreadcrumb); let topValue = menuStart.getBoundingClientRect().bottom; // console.log("topValue", topValue); @@ -2004,26 +2003,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { return; } - menu.classList.toggle('hidden'); //sets hidden or removes it - - // TODO: fix or delete - // computations for overflow - begin - // if (this.menuHeightAdditional === -1) { - // this.menuHeightAdditional = menu.clientHeight; - // } - - // let topValue = menuStart.getBoundingClientRect().bottom; - // let isMenuOverflow = this.menuHeightAdditional + topValue >= window.innerHeight ? true : false; - - // if (isMenuOverflow && !menu.classList.contains('hidden')) { - // menu.setAttribute('style', 'position: fixed;top: ' + topValue + 'px;bottom: 0;border-bottom: 0;overflow-y: auto;'); - // menu.scrollTop = 0; - // document.body.setAttribute('style', 'overflow:hidden;'); - // } else if (isMenuOverflow && menu.classList.contains('hidden')) { - // document.body.removeAttribute('style', 'overflow:hidden;'); - // menu.removeAttribute('style'); - // } - // computations for overflow - end + menu.classList.toggle('hidden'); if (!menu.classList.contains('hidden')) { // add event listener for clicking outside of menu document.addEventListener('click', this.boundCloseAdditionalMenuHandler); -- GitLab