cache fixed, delete buttons fixed
This commit is contained in:
@@ -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.');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user