From 4946750beb59043eaba5832a4ac597eff3de4022 Mon Sep 17 00:00:00 2001 From: Lukas Schulze <820580+lsgd@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:49:01 +0200 Subject: [PATCH 1/2] enable upload via clipboard paste --- src/js/app.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/js/app.js b/src/js/app.js index 692e055..ca27f07 100755 --- a/src/js/app.js +++ b/src/js/app.js @@ -48,6 +48,10 @@ var app = { $('.alert').slideUp(500); }); + if ($('.dropzone').length > 0) { + app.initClipboardPasteToUpload(); + } + new ClipboardJS('.btn-clipboard'); new Plyr($('#player'), {ratio: '16:9'}); @@ -252,7 +256,20 @@ var app = { $('#dropdown-tag-list > a[data-id="' + $tag.data('id') + '"]').remove(); } }); - } + }, + initClipboardPasteToUpload: function() { + document.onpaste = function(event){ + if (event.clipboardData || event.originalEvent.clipboardData) { + const items = (event.clipboardData || event.originalEvent.clipboardData).items; + items.forEach((item) => { + if (item.kind === 'file') { + // Add the file to the dropzone instance. + Dropzone.forElement('.dropzone').addFile(item.getAsFile()); + } + }); + } + } + }, }; app.init(); From a600a21753c676b7418ef12828807a549fd5cc0f Mon Sep 17 00:00:00 2001 From: Lukas Schulze <820580+lsgd@users.noreply.github.com> Date: Tue, 30 Apr 2024 16:15:41 +0200 Subject: [PATCH 2/2] Add link to remove tags filter --- resources/lang/de.lang.php | 1 + resources/lang/en.lang.php | 1 + resources/templates/dashboard/pager_header.twig | 1 + 3 files changed, 3 insertions(+) diff --git a/resources/lang/de.lang.php b/resources/lang/de.lang.php index 1fe6ffc..256d9ba 100644 --- a/resources/lang/de.lang.php +++ b/resources/lang/de.lang.php @@ -153,6 +153,7 @@ return [ 'mail.new_account' => '%s – Erstellung von Konto', 'user_create_password' => 'Wenn das leer bleibt, wollen Sie vielleicht eine Benachrichtigung an die Benutzer per E-Mail senden.', 'no_tags' => 'Keine Tags hinzugefügt', + 'show_all_tags' => 'Alle Tags anzeigen', 'upload_max_file_size' => 'Die maximale Dateigröße beträgt derzeit %s.', 'ldap_cant_connect' => 'Es kann keine Verbindung zum LDAP-Auth-Server hergestellt werden.', 'zip_ext_not_loaded' => 'Die zip-Erweiterung ist erforderlich', diff --git a/resources/lang/en.lang.php b/resources/lang/en.lang.php index 95c3650..32c1a54 100755 --- a/resources/lang/en.lang.php +++ b/resources/lang/en.lang.php @@ -156,6 +156,7 @@ return [ 'ldap_cant_connect' => 'Can\'t connect to the LDAP auth server.', 'upload_max_file_size' => 'The max file size is currently %s.', 'no_tags' => 'No tags added', + 'show_all_tags' => 'Show all tags', 'auto_tagging' => 'Auto upload tagging', 'zip_ext_not_loaded' => 'The required "zip" extension is not loaded', 'changelog' => 'Changelog', diff --git a/resources/templates/dashboard/pager_header.twig b/resources/templates/dashboard/pager_header.twig index 96e9872..555e6b0 100644 --- a/resources/templates/dashboard/pager_header.twig +++ b/resources/templates/dashboard/pager_header.twig @@ -16,6 +16,7 @@ {% if tags is empty %} {% else %} + {{ lang('show_all_tags') }} {% for tag in tags %} {{ tag.name }} {% endfor %}