Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable upload from clipboard #572

Merged
merged 3 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading