Skip to content

Commit

Permalink
Merge pull request #572 from lsgd/master
Browse files Browse the repository at this point in the history
Enable upload from clipboard
  • Loading branch information
sergix44 authored Jun 15, 2024
2 parents cc8ed75 + a600a21 commit 06562d1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions resources/lang/de.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
'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',
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
'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',
Expand Down
1 change: 1 addition & 0 deletions resources/templates/dashboard/pager_header.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{% if tags is empty %}
<h6 class="dropdown-header">{{ lang('no_tags') }}</h6>
{% else %}
<a class="dropdown-item" href="{{ route('home') }}">{{ lang('show_all_tags') }}</a>
{% for tag in tags %}
<a class="dropdown-item {{ request.queryParams['tag'] == tag.id ? 'active' }}" href="{{ queryParams({'tag': tag.id}) }}" data-id="{{ tag.id }}">{{ tag.name }}</a>
{% endfor %}
Expand Down
19 changes: 18 additions & 1 deletion src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'});

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 06562d1

Please sign in to comment.