Merge pull request #572 from lsgd/master

Enable upload from clipboard
This commit is contained in:
Sergio Brighenti 2024-06-15 21:57:01 +02:00 committed by GitHub
commit 06562d194b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 1 deletions

View file

@ -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',

View file

@ -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',

View file

@ -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 %}

View file

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