| 8037 | }); |
| 8038 | delete window._electronPendingEvents['open-metadata-editor']; |
| 8039 | } |
| 8040 | |
| 8041 | // Tab switching functionality - initialize when dialog is available |
| 8042 | function initializeMetadataTabs() { |
| 8043 | document.querySelectorAll('.metadata-tab').forEach(tab => { |
| 8044 | // Remove existing listeners to avoid duplicates |
| 8045 | const newTab = tab.cloneNode(true); |
| 8046 | tab.parentNode.replaceChild(newTab, tab); |
| 8047 | |
| 8048 | newTab.addEventListener('click', () => { |
| 8049 | const type = newTab.dataset.type; |
| 8050 | currentMetadataType = type; |
| 8051 | updateMetadataTabs(); |
| 8052 | refreshMetadataList(type); |
| 8053 | // Clear search when switching tabs |
| 8054 | const searchInput = document.getElementById('metadata-editor-search'); |
| 8055 | if (searchInput) { |
| 8056 | searchInput.value = ''; |
| 8057 | } |