cache fixed, delete buttons fixed

This commit is contained in:
Dobromir Popov
2025-10-24 21:34:23 +03:00
parent 420251f2d4
commit 6e58f4d88f
5 changed files with 149 additions and 40 deletions

View File

@@ -165,18 +165,32 @@
item.querySelector('.delete-annotation-btn').addEventListener('click', function(e) {
e.stopPropagation();
console.log('Delete button clicked for:', annotation.annotation_id);
console.log('=== Delete annotation button clicked ===');
console.log('Annotation ID:', annotation.annotation_id);
console.log('window.deleteAnnotation type:', typeof window.deleteAnnotation);
console.log('window object keys:', Object.keys(window).filter(k => k.includes('delete')));
console.log('window object keys containing delete:', Object.keys(window).filter(k => k.includes('delete')));
// Use window.deleteAnnotation to ensure we get the global function
if (typeof window.deleteAnnotation === 'function') {
console.log('Calling window.deleteAnnotation...');
window.deleteAnnotation(annotation.annotation_id);
try {
window.deleteAnnotation(annotation.annotation_id);
} catch (error) {
console.error('Error calling deleteAnnotation:', error);
if (typeof window.showError === 'function') {
window.showError('Error calling delete function: ' + error.message);
} else {
alert('Error calling delete function: ' + error.message);
}
}
} else {
console.error('window.deleteAnnotation is not a function:', typeof window.deleteAnnotation);
console.log('Available functions:', Object.keys(window).filter(k => typeof window[k] === 'function'));
alert('Delete function not available. Please refresh the page.');
if (typeof window.showError === 'function') {
window.showError('Delete function not available. Please refresh the page.');
} else {
alert('Delete function not available. Please refresh the page.');
}
}
});