From f5f0d2978b2a8f8c6f2a0ad8073ff20f5420be21 Mon Sep 17 00:00:00 2001
From: Christina Toegl <toegl@tugraz.at>
Date: Thu, 31 Mar 2022 13:32:16 +0200
Subject: [PATCH] Fix height and clicking behaviour in nextcloud submenu; fix
 typos

---
 .../src/i18n/de/translation.json              |  2 +-
 .../src/i18n/en/translation.json              |  4 +-
 .../src/nextcloud-file-picker.js              | 69 ++++++++-----------
 3 files changed, 31 insertions(+), 44 deletions(-)

diff --git a/packages/file-handling/src/i18n/de/translation.json b/packages/file-handling/src/i18n/de/translation.json
index b120b419..addc35df 100644
--- a/packages/file-handling/src/i18n/de/translation.json
+++ b/packages/file-handling/src/i18n/de/translation.json
@@ -44,7 +44,7 @@
         "auth-info": "Eine neue Seite wird geöffnet, um Ihr Konto zu verbinden.",
         "connect-nextcloud": "{{name}} verbinden",
         "no-data": "In diesem Ordner befinden sich keine Dateien.",
-        "no-data-type": "In diesem Ordner befinden sich keine Daten vom benötigten Typ.",
+        "no-data-type": "In diesem Ordner befinden sich keine Dateien vom benötigten Typ.",
         "no-favorites": "Es wurden keine Favoriten des entsprechenden Typs gefunden. Definieren Sie Dateien und Ordner in Ihrer {{name}} als Favoriten, um diese hier anzuzeigen.",
         "no-recent-files": "Es wurden keine entsprechenden Dateien und Ordner innerhalb der letzten 3 Monate gefunden.",
         "webdav-error": "Etwas ist schief gelaufen: {{error}}",
diff --git a/packages/file-handling/src/i18n/en/translation.json b/packages/file-handling/src/i18n/en/translation.json
index d2b001a4..a8d4129e 100644
--- a/packages/file-handling/src/i18n/en/translation.json
+++ b/packages/file-handling/src/i18n/en/translation.json
@@ -44,8 +44,8 @@
         "init-text-2": "You need to authenticate first.",
         "auth-info": "A new page will open to connect your account.",
         "connect-nextcloud": "Connect {{name}}",
-        "no-data": "No data avaible in this folder.",
-        "no-data-type": "No data avaible in this folder.",
+        "no-data": "No data available in this folder.",
+        "no-data-type": "No data available in this folder.",
         "no-favorites": "No favorites of the relevant type were found. Define files and folders as favorites in your {{name}} to display them here",
         "no-recent-files": "No relevant files and folders were found within the last 3 months.",
         "webdav-error": "Something went wrong",
diff --git a/packages/file-handling/src/nextcloud-file-picker.js b/packages/file-handling/src/nextcloud-file-picker.js
index bafcdd52..6a29657d 100644
--- a/packages/file-handling/src/nextcloud-file-picker.js
+++ b/packages/file-handling/src/nextcloud-file-picker.js
@@ -137,6 +137,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                         this._('#select_all_wrapper').classList.add('button-container');
                         this._('#select_all_wrapper').classList.remove('hidden');
                     }
+                    break;
             }
         });
 
@@ -824,16 +825,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                         {column: "type", dir: "asc"},
                     ]);
 
-                    if (
-                        this._('#directory-content-table').querySelector(
-                            'div.tabulator-tableHolder > div.tabulator-placeholder > span'
-                        )
-                    ) {
-                        this._('#directory-content-table').querySelector(
-                            'div.tabulator-tableHolder > div.tabulator-placeholder > span'
-                        ).innerText = i18n.t('nextcloud-file-picker.no-favorites', {
-                            name: this.nextcloudName,
-                        });
+                    if (this._('.tabulator-placeholder-contents')) {
+                        this._('.tabulator-placeholder-contents').innerText = 
+                            i18n.t('nextcloud-file-picker.no-favorites', {
+                                name: this.nextcloudName,
+                            });
                     }
 
                     this.isPickerActive = true;
@@ -992,14 +988,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                     this.tabulatorTable.setData(dataObject);
                     this.tabulatorTable.setSort([{column: 'lastmod', dir: 'desc'}]);
 
-                    if (
-                        this._('#directory-content-table').querySelector(
-                            'div.tabulator-tableHolder > div.tabulator-placeholder > span'
-                        )
-                    ) {
-                        this._('#directory-content-table').querySelector(
-                            'div.tabulator-tableHolder > div.tabulator-placeholder > span'
-                        ).innerText = i18n.t('nextcloud-file-picker.no-recent-files');
+                    if (this._('.tabulator-placeholder-contents')) {
+                        this._('.tabulator-placeholder-contents').innerText = 
+                            i18n.t('nextcloud-file-picker.no-recent-files', {
+                                name: this.nextcloudName,
+                            });
                     }
 
                     this.isPickerActive = true;
@@ -1161,14 +1154,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                     this.tabulatorTable.setData(dataObject);
                     this.tabulatorTable.setSort([{column: 'lastmod', dir: 'desc'}]);
 
-                    if (
-                        this._('#directory-content-table').querySelector(
-                            'div.tabulator-tableHolder > div.tabulator-placeholder > span'
-                        )
-                    ) {
-                        this._('#directory-content-table').querySelector(
-                            'div.tabulator-tableHolder > div.tabulator-placeholder > span'
-                        ).innerText = i18n.t('nextcloud-file-picker.no-recent-files');
+                    if (this._('.tabulator-placeholder-contents')) {
+                        this._('.tabulator-placeholder-contents').innerText = 
+                            i18n.t('nextcloud-file-picker.no-recent-files', {
+                                name: this.nextcloudName,
+                            });
                     }
 
                     this.isPickerActive = true;
@@ -2401,7 +2391,9 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
             return;
         }
         const menu = this.shadowRoot.querySelector('ul.extended-menu');
-        if (menu && !menu.classList.contains('hidden')) this.toggleMoreMenu();
+        if (menu && !menu.classList.contains('hidden')) {
+            this.toggleMoreMenu();
+        }
     }
 
     _atChangeInput(event) {
@@ -2488,7 +2480,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                 white-space: nowrap;
                 overflow: hidden;
                 text-overflow: ellipsis;
-                max-width: 130px;
             }
 
             .nextcloud-nav a.home-link {
@@ -2613,11 +2604,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                 padding-left: 4px;
             }
 
-            .extended-menu li {
-                padding: 7px;
-                padding-right: 46px;
-            }
-
             .extended-menu a.inactive {
                 color: var(--dbp-muted);
                 pointer-events: none;
@@ -2625,7 +2611,8 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
             }
 
             .extended-menu a {
-                padding: 8px;
+                padding: 7px 54px 7px 15px;
+                display: block;
             }
 
             .extended-menu {
@@ -3237,7 +3224,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                                             this.disableRowClick,
                                 })}">
                                     <a class=""
-                                       @click="${() => {
+                                        @click="${() => {
                                            this.addOpenFolderTableEntry();
                                        }}">
                                         ${i18n.t('nextcloud-file-picker.add-folder')}
@@ -3246,12 +3233,12 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                                 <li
                                         class="${classMap({hidden: !this.storeSession})}"
                                         title="${i18n.t('nextcloud-file-picker.log-out')}">
-                                    <a
-                                            class=""
-                                            @click="${() => {
-                                                this.logOut();
-                                                this.hideAdditionalMenu();
-                                            }}">
+                                    <a 
+                                        class=""
+                                        @click="${() => {
+                                            this.logOut();
+                                            this.hideAdditionalMenu();
+                                        }}">
                                         ${i18n.t('nextcloud-file-picker.log-out')}
                                     </a>
                                 </li>
-- 
GitLab