Merge pull request #1737 from PrivateBin/attachment_disappears_after_paste_fix

fix: Attachment disappears after a "paste" in the message area
This commit is contained in:
El RIDO 2025-12-10 07:11:47 +01:00 committed by GitHub
commit 5a067e893f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View file

@ -5,6 +5,7 @@
* CHANGED: Deduplicate JSON error message translations
* CHANGED: Refactored translation of exception messages
* FIXED: Some exceptions not getting translated
* FIXED: Attachment disappears after a "paste" in the message area (#1731)
## 1.7.9 (2025-11-13)
* CHANGED: Upgrading libraries to: base-x 5.0.1, bootstrap 5.3.8, DOMpurify 3.2.7, ip-lib 1.21.0 & kjua 0.10.0

View file

@ -3399,19 +3399,21 @@ jQuery.PrivateBin = (function($) {
* @function
*/
function addClipboardEventHandler() {
$('#message').on('paste', function (event) {
document.addEventListener('paste', (event) => {
const items = (event.clipboardData || event.originalEvent.clipboardData).items;
const files = [...items]
.filter(item => item.kind === 'file')
.map(item => item.getAsFile());
if (TopNav.isAttachmentReadonly()) {
if (TopNav.isAttachmentReadonly() && files.length) {
event.stopPropagation();
event.preventDefault();
return false;
}
readFileData(files);
if (files.length) {
readFileData(files);
}
});
}

View file

@ -122,7 +122,7 @@ class Configuration
'js/kjua-0.10.0.js' => 'sha512-BYj4xggowR7QD150VLSTRlzH62YPfhpIM+b/1EUEr7RQpdWAGKulxWnOvjFx1FUlba4m6ihpNYuQab51H6XlYg==',
'js/legacy.js' => 'sha512-rGXYUpIqbFoHAgBXZ0UlJBdNAIMOC9EQ67MG0X46D5uRB8LvwzgKirbSQRGdYfk8I2jsUcm+tvHXYboUnC6DUg==',
'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==',
'js/privatebin.js' => 'sha512-v2ROwoYhqiYYi2ayUTOOtsU4KVf4oy947SmZ5zJr5H0fGLmu7bXbo7TAzxnpgJ7B2cxq/yWQtk5tXb/VFmtyfA==',
'js/privatebin.js' => 'sha512-WyXqnKduXRN1dClbnznN/GoOAhjpEzmtc4d3xrgoaMlFR/7YtfJtMvGIoLbX8S2Bx5GMhvbGOocRa28INaewcQ==',
'js/purify-3.3.0.js' => 'sha512-lsHD5zxs4lu/NDzaaibe27Vd2t7Cy9JQ3qDHUvDfb4oZvKoWDNEhwUY+4bT3R68cGgpgCYp8U1x2ifeVxqurdQ==',
'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==',
'js/zlib-1.3.1-1.js' => 'sha512-5bU9IIP4PgBrOKLZvGWJD4kgfQrkTz8Z3Iqeu058mbQzW3mCumOU6M3UVbVZU9rrVoVwaW4cZK8U8h5xjF88eQ==',