From 4bb4994b32ac966619251a23f1fbd508d8006544 Mon Sep 17 00:00:00 2001 From: Tamara Steinwender <tamara.steinwender@tugraz.at> Date: Thu, 15 Apr 2021 13:38:58 +0200 Subject: [PATCH] Update clipboard --- .../src/dbp-file-handling-clipboard.js | 17 ++++++++--------- .../file-handling/src/i18n/de/translation.json | 3 ++- .../file-handling/src/i18n/en/translation.json | 3 ++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/file-handling/src/dbp-file-handling-clipboard.js b/packages/file-handling/src/dbp-file-handling-clipboard.js index 709f8229..f3a29759 100644 --- a/packages/file-handling/src/dbp-file-handling-clipboard.js +++ b/packages/file-handling/src/dbp-file-handling-clipboard.js @@ -300,16 +300,17 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { return; } - send({ - "summary": i18n.t('clipboard.file-warning'), - "body": i18n.t('clipboard.file-warning-body', {count: this.clipboardFiles.files.length}), - "type": "warning", - "timeout": 5, - }); + // we need to handle custom events ourselves if(event.target && event.target.activeElement && event.target.activeElement.nodeName) { + send({ + "summary": i18n.t('clipboard.file-warning'), + "body": i18n.t('clipboard.file-warning-body', {count: this.clipboardFiles.files.length}), + "type": "warning", + "timeout": 5, + }); if (!event.isTrusted) { // note that this only works with custom event since calls of "confirm" are ignored // in the non-custom event, see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event @@ -540,14 +541,12 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { <dbp-icon name="warning" class="warning-icon"></dbp-icon> <p>${i18n.t('file-sink.save-to-clipboard-warning')}</p> </div> - - <!-- filesink for clipboard TODO übersetzen--> <div class="${classMap({"hidden": this.clipboardFiles.files.length === 0})}"> <button id="clipboard-download-button" class="button is-right clipboard-btn" @click="${this.openClipboardFileSink}" - >Aktuellen Zwischenablageninhalt speichern</button> + >${i18n.t('clipboard.save-from-clipboard-btn')}</button> </div> <dbp-file-sink id="file-sink-clipboard" diff --git a/packages/file-handling/src/i18n/de/translation.json b/packages/file-handling/src/i18n/de/translation.json index c3972041..60a4c0aa 100644 --- a/packages/file-handling/src/i18n/de/translation.json +++ b/packages/file-handling/src/i18n/de/translation.json @@ -102,6 +102,7 @@ "file-warning-body": "Es befindet sich noch eine Datei in der Zwischenablage. Die Zwischenablage wird beim Verlassen der Seite automatisch verworfen.", "file-warning-body_plural": "Es befinden sich noch {{count}} Dateien in der Zwischenablage. Die Zwischenablage wird beim Verlassen der Seite automatisch verworfen.", "save-files-from-clipboard": "Eine Datei aus der Zwischenablage speichern", - "save-files-from-clipboard_plural": "{{count}} Dateien aus der Zwischenablage speichern" + "save-files-from-clipboard_plural": "{{count}} Dateien aus der Zwischenablage speichern", + "save-from-clipboard-btn": "Aktuellen Inhalt aus der Zwischenablage speichern" } } diff --git a/packages/file-handling/src/i18n/en/translation.json b/packages/file-handling/src/i18n/en/translation.json index 1321a2d8..1e74f3b9 100644 --- a/packages/file-handling/src/i18n/en/translation.json +++ b/packages/file-handling/src/i18n/en/translation.json @@ -102,6 +102,7 @@ "file-warning-body": "There is still a file on the clipboard. The clipboard is automatically discarded when you exit the page.", "file-warning-body_plural": "There are still {{count}} files on the clipboard. The clipboard is automatically discarded when you exit the page.", "save-files-from-clipboard": "Save a file from the clipboard", - "save-files-from-clipboard_plural": "Save {{count}} files from the clipboard" + "save-files-from-clipboard_plural": "Save {{count}} files from the clipboard", + "save-from-clipboard-btn": "Save the current content from the clipboard" } } -- GitLab