diff --git a/packages/file-handling/src/i18n/de/translation.json b/packages/file-handling/src/i18n/de/translation.json index 098c2491bd120561f5b695e9a2b321a861ec4c78..f1af296ef3635e76a231b593907aff234ad5c9f1 100644 --- a/packages/file-handling/src/i18n/de/translation.json +++ b/packages/file-handling/src/i18n/de/translation.json @@ -45,8 +45,8 @@ "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-favorites": "Es wurden keine Favoriten des entsprechenden Typs gefunden.\nDefinieren Sie in Ihrer {{name}} Dateien und Ordner als Favoriten, um diese hier anzuzeigen.", - "no-recent-files": "Es wurden keine Dateien entsprechenden Dateien und Ordner innerhalb der letzten 3 Monate gefunden.", + "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}}", "add-folder-error": "Die Ressource \"{{folder}}\", ist bereits vorhanden.", "add-folder-success": "Der Ordner \"{{folder}}\" wurde erfolgreich erstellt.", diff --git a/packages/file-handling/src/i18n/en/translation.json b/packages/file-handling/src/i18n/en/translation.json index 7b6e481a670beaf2692d1b57a27502f13c654484..b7c766e641d35632eb13b697943952ac6e3d309a 100644 --- a/packages/file-handling/src/i18n/en/translation.json +++ b/packages/file-handling/src/i18n/en/translation.json @@ -46,8 +46,8 @@ "connect-nextcloud": "Connect {{name}}", "no-data": "No data avaible in this folder.", "no-data-type": "No data avaible in this folder.", - "no-favorites": "No favorites could be found.", - "no-recent-files": "No recent files could be found from the last 3 months.", + "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", "add-folder-error": "The resource \"{{folder}}\" you tried to create already exists.", "add-folder-success": "The folder '{{folder}}' was created successfully.", diff --git a/packages/file-handling/src/nextcloud-file-picker.js b/packages/file-handling/src/nextcloud-file-picker.js index 40a76cb21c8dfde2a4b7fb13d039bbe9798fbdda..f1747815d4e1efc75ccb8e9c65d6bc48888b8bc4 100644 --- a/packages/file-handling/src/nextcloud-file-picker.js +++ b/packages/file-handling/src/nextcloud-file-picker.js @@ -71,10 +71,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { this.boundCloseBreadcrumbMenuHandler = this.hideBreadcrumbMenu.bind(this); this.initateOpenBreadcrumbMenu = false; - this.boundClickOutsideNewFolderHandler = this.cancelNewFolderCreation.bind(this); + this.boundClickOutsideNewFolderHandler = this.deleteNewFolderEntry.bind(this); this.initateOpenNewFolder = false; this.disableRowClick = false; + } static get scopedElements() { @@ -183,9 +184,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { responsiveLayout: "collapse", responsiveLayoutCollapseStartOpen: false, resizableColumns: false, - // autoResize: true, //TODO - // virtualDomBuffer: 1000, //TODO - // reactiveData: true, //TODO columns: [ { width: 32, @@ -342,8 +340,9 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { row.deselect(); } } else { // TODO - console.log('reached'); + console.log('reached 1'); if (this._('#tf-new-folder')) { + console.log('reached 2'); this._('#tf-new-folder').focus(); // this._('#tf-new-folder').select(); } @@ -405,6 +404,12 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { // that.addFolder(); // } // }); + + window.addEventListener("resize", function () { + that.requestUpdate(); + // that.tabulatorTable.redraw(true); //TODO new folder doesn't work + }); + }); } @@ -1644,7 +1649,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { addOpenFolderTableEntry() { const i18n = this._i18n; - if (this._('.addRowAnimation')) { //TODO verify + if (this._('.addRowAnimation')) { this._('.addRowAnimation').classList.remove('addRowAnimation'); } this.disableRowClick = true; @@ -1657,23 +1662,14 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { props: props }; - var data = this.tabulatorTable.getData(); - console.log('1', data); - const that = this; - // this.tabulatorTable.addData(row, true); //this this.tabulatorTable.addRow(row, true, 1).then(() => { - - // setTimeout(function(){ - // that.tabulatorTable.redraw(true); - // }, 0); - that._('#directory-content-table').querySelector("div.tabulator-tableHolder > div.tabulator-table > div.tabulator-row:nth-child(1)").setAttribute('id', 'new-folder-row'); that._('#new-folder-row').classList.toggle('highlighted'); - that._('#new-folder-row').querySelector("div.tabulator-cell:nth-child(1) > div > span.tabulator-responsive-collapse-toggle-open").classList.add('new-folder-selected'); - that._('#new-folder-row').querySelector("div.tabulator-cell:nth-child(1) > div > span.tabulator-responsive-collapse-toggle-close").classList.add('new-folder-selected'); + that._('#new-folder-row').querySelector("div.tabulator-cell:nth-child(1) > div > span.tabulator-responsive-collapse-toggle-open").classList.add('new-folder-selected'); //TODO + that._('#new-folder-row').querySelector("div.tabulator-cell:nth-child(1) > div > span.tabulator-responsive-collapse-toggle-close").classList.add('new-folder-selected'); //TODO that._('#new-folder-row').querySelector("div.tabulator-cell:nth-child(6)").innerText = ''; that._('#new-folder-row').querySelector("div.tabulator-cell:nth-child(3)").setAttribute('id', 'new-folder-cell'); @@ -1688,15 +1684,15 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { } }) - that._('#tf-new-folder').addEventListener("keydown", ({key}) => { - if (key === "Escape") { + that._('#new-folder-row').addEventListener("keydown", event => { + if (event.key === "Escape") { console.log('ESC pressed'); - that.cancelNewFolderCreation(); + that.deleteNewFolderEntry(); + event.stopPropagation(); } }) - that._('#tf-new-folder').addEventListener("click", (event) => { - // console.log('clicked inside', event); + that._('#new-folder-row').addEventListener("click", (event) => { that._('#tf-new-folder').select(); event.stopPropagation(); }) @@ -1707,50 +1703,16 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { console.log('error', error); }); - var data2 = this.tabulatorTable.getData(); - console.log('2', data2); - - // row id - // this._('#directory-content-table').querySelector("div.tabulator-tableHolder > div.tabulator-table > div.tabulator-row:nth-child(1)").setAttribute('id', 'new-folder-row'); - - // this._('#new-folder-row').setAttribute('style', 'background: #259207; color: white'); - // this._('#new-folder-row').querySelector("div.tabulator-cell:nth-child(1) > div > span.tabulator-responsive-collapse-toggle-open").classList.add('new-folder-selected'); - // this._('#new-folder-row').querySelector("div.tabulator-cell:nth-child(1) > div > span.tabulator-responsive-collapse-toggle-close").classList.add('new-folder-selected'); - - // this._('#new-folder-row').querySelector("div.tabulator-cell:nth-child(6)").innerText = ''; - // this._('#new-folder-row').querySelector("div.tabulator-cell:nth-child(3)").setAttribute('id', 'new-folder-cell'); - - // // add text input field - // this._('#new-folder-cell').innerHTML = '<input type="text" class="input" name="tf-new-folder" id ="tf-new-folder" value="'+ i18n.t('nextcloud-file-picker.new-folder-placeholder') +'" placeholder="'+ i18n.t('nextcloud-file-picker.new-folder-placeholder') + '" />'; - - // this._('#tf-new-folder').addEventListener("keydown", ({key}) => { - // if (key === "Enter") { - // console.log('ENTER pressed'); - // this.addNewFolder(); - // } - // }) - - // this._('#tf-new-folder').addEventListener("keydown", ({key}) => { - // if (key === "Escape") { - // console.log('ESC pressed'); - // this.cancelNewFolderCreation(); - // } - // }) - - // this._('#tf-new-folder').addEventListener("click", (event) => { - // console.log('clicked inside', event); - // //TODO do we need to set focus? - // this._('#tf-new-folder').select(); - // event.stopPropagation(); - // }) - - // document.addEventListener('click', this.boundClickOutsideNewFolderHandler); - // this.initateOpenNewFolder = true; - // // during folder creation it should not be possible to click something document.addEventListener('click', this.boundClickOutsideNewFolderHandler); + + this.tabulatorTable.getRows().forEach((row) => { + if (row.getElement().classList.contains('tabulator-selected')) { + row.getElement().classList.remove('tabulator-selected'); + } + }) - // // disable selection of rows during folder creation + // disable selection of rows during folder creation // this.tabulatorTable.getRows().forEach((row) => { // row.getElement().classList.add("no-select"); // row.getElement().classList.remove("tabulator-selectable"); @@ -1761,15 +1723,12 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { // this._('#tf-new-folder').select(); } - cancelNewFolderCreation() { - + deleteNewFolderEntry() { if (this.initateOpenNewFolder) { this.initateOpenNewFolder = false; return; } - - console.log('canceled folder creation'); - + // console.log('canceled folder creation'); this._('#new-folder-row').classList.toggle('highlighted'); var row = this.tabulatorTable.getRowFromPosition(0); @@ -1788,7 +1747,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { if (typeof this.directoryPath === 'undefined') { this.directoryPath = ''; } - this.cancelNewFolderCreation(); + this.deleteNewFolderEntry(); let folderPath = this.directoryPath + "/" + folderName; this.webDavClient.createDirectory(folderPath).then(contents => { @@ -1816,8 +1775,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { class="error"> ${i18n.t('nextcloud-file-picker.webdav-error', {error: error.message})} </span>`; } }) - .finally(() => { // folder should be created now - delete default entry - + .finally(() => { // this.tabulatorTable.getRows().forEach((row) => { // let data = row.getData(); // if (!this.checkFileType(data, this.allowedMimeTypes)) { @@ -2125,6 +2083,10 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ${commonStyles.getRadioAndCheckboxCss()} ${fileHandlingStyles.getFileHandlingCss()} + div.tabulator-placeholder span { + white-space: normal; + } + #new-folder-row.highlighted { background: #259207; color: white;