Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
125 changes: 125 additions & 0 deletions website/templates/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ <h2 class="text-xl font-semibold text-gray-900 truncate">{% trans "Bug Descripti
<p class="text-xs text-gray-400">PNG, JPG, GIF up to 5 images</p>
</div>
</div>
<div class="mt-2 text-xs text-gray-500 flex items-center justify-center">
<i class="fas fa-keyboard mr-1"></i>
<span>Pro tip: You can also paste images directly (Ctrl+V)</span>
</div>
</div>
<div id="files_manage"
class="mt-4 w-full flex flex-col gap-4 items-center"></div>
Expand Down Expand Up @@ -476,6 +480,127 @@ <h2 class="text-xl font-semibold text-gray-900">{% trans "Team Members" %}</h2>
let email_container = document.getElementById("email-container");
email_container.appendChild(email_container_child_html)
}
// Enhanced paste functionality for screenshot uploads
document.addEventListener('DOMContentLoaded', function() {
// Make the entire page listen for paste events
document.addEventListener('paste', function(e) {
// Only process paste if we're focused on relevant elements or the document body
const activeElement = document.activeElement;
const notInTextInput = activeElement.tagName !== 'INPUT' &&
activeElement.tagName !== 'TEXTAREA' &&
!activeElement.isContentEditable;

if (notInTextInput || activeElement === document.body) {
var items = (e.clipboardData || e.originalEvent.clipboardData).items;
let foundImage = false;

for (var index in items) {
var item = items[index];
if (item.kind === 'file' && item.type.indexOf('image/') !== -1) {
foundImage = true;
var blob = item.getAsFile();
var reader = new FileReader();

reader.onload = function(event) {
// Create a unique filename with timestamp
const timestamp = new Date().getTime();
const filename = `pasted-image-${timestamp}.png`;

// Create a File object from the blob with our custom filename
var file = new File([blob], filename, {type: blob.type});

// Add file to the file input
var dt = new DataTransfer();
var fileInput = document.getElementById('screenshots');

// Add existing files
if (fileInput && fileInput.files) {
for (var i = 0; i < fileInput.files.length; i++) {
dt.items.add(fileInput.files[i]);
}
}

// Add the new file
dt.items.add(file);

// Replace the file input's FileList
if (fileInput) {
fileInput.files = dt.files;

// Trigger the change event to update the UI
fileInput.dispatchEvent(new Event('change', { bubbles: true }));

// Show toast notification
showToast('Image pasted successfully!');
}
};
reader.readAsDataURL(blob);
break;
}
}

if (foundImage) {
e.preventDefault();
}
}
});

// Add a toast notification system
if (!document.getElementById('toast-container')) {
const toastContainer = document.createElement('div');
toastContainer.id = 'toast-container';
toastContainer.style.cssText = 'position: fixed; bottom: 20px; right: 20px; z-index: 10000;';
document.body.appendChild(toastContainer);
}
});

// Function to show toast notifications
function showToast(message, type = 'success') {
const toastContainer = document.getElementById('toast-container');
const toast = document.createElement('div');

// Set toast styling based on type
const backgroundColor = type === 'success' ? '#10b981' : '#ef4444';

toast.style.cssText = `
background-color: ${backgroundColor};
color: white;
padding: 12px 20px;
border-radius: 8px;
margin-top: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
opacity: 0;
transform: translateY(20px);
transition: all 0.3s ease;
`;

// Add icon based on type
const icon = type === 'success' ? 'fa-check-circle' : 'fa-exclamation-circle';
toast.innerHTML = `
<i class="fas ${icon} mr-2"></i>
<span>${message}</span>
`;

toastContainer.appendChild(toast);

// Trigger animation
setTimeout(() => {
toast.style.opacity = '1';
toast.style.transform = 'translateY(0)';
}, 10);

// Auto-remove toast after 3 seconds
setTimeout(() => {
toast.style.opacity = '0';
toast.style.transform = 'translateY(-20px)';

setTimeout(() => {
toastContainer.removeChild(toast);
}, 300);
}, 3000);
}

document.addEventListener("DOMContentLoaded", function() {
// Get the value from the URL parameter
Expand Down