@trustquery/browser 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/trustquery.js +50 -0
- package/dist/trustquery.js.map +1 -1
- package/package.json +1 -1
- package/src/AttachmentManager.js +50 -0
package/dist/trustquery.js
CHANGED
|
@@ -3566,6 +3566,56 @@ class AttachmentManager {
|
|
|
3566
3566
|
// Update metadata
|
|
3567
3567
|
attachment.metadata.headers = headers;
|
|
3568
3568
|
|
|
3569
|
+
// Re-scan headers for matches
|
|
3570
|
+
const newMatches = this.scanCSVHeaders(headers);
|
|
3571
|
+
attachment.matches = newMatches;
|
|
3572
|
+
|
|
3573
|
+
// Update icon visibility based on matches
|
|
3574
|
+
if (attachment.wrapper) {
|
|
3575
|
+
const iconPlaceholder = attachment.wrapper.querySelector('.tq-attachment-icon-placeholder');
|
|
3576
|
+
const existingIcon = iconPlaceholder?.querySelector('.tq-attachment-icon');
|
|
3577
|
+
|
|
3578
|
+
if (newMatches.length === 0 && existingIcon) {
|
|
3579
|
+
// No more matches - remove the icon
|
|
3580
|
+
existingIcon.remove();
|
|
3581
|
+
if (this.options.debug) {
|
|
3582
|
+
console.log('[AttachmentManager] Removed warning icon - all warnings resolved');
|
|
3583
|
+
}
|
|
3584
|
+
} else if (newMatches.length > 0 && !existingIcon) {
|
|
3585
|
+
// New matches appeared - add icon (shouldn't happen in normal flow, but handle it)
|
|
3586
|
+
const match = newMatches[0];
|
|
3587
|
+
const messageState = match.intent?.handler?.['message-state'] || 'warning';
|
|
3588
|
+
const iconMap = {
|
|
3589
|
+
'error': 'trustquery-error.svg',
|
|
3590
|
+
'warning': 'trustquery-warning.svg',
|
|
3591
|
+
'info': 'trustquery-info.svg'
|
|
3592
|
+
};
|
|
3593
|
+
|
|
3594
|
+
const icon = document.createElement('img');
|
|
3595
|
+
icon.className = 'tq-attachment-icon';
|
|
3596
|
+
icon.src = `./assets/${iconMap[messageState] || iconMap.warning}`;
|
|
3597
|
+
icon.title = `CSV column ${messageState} - click to review`;
|
|
3598
|
+
|
|
3599
|
+
// Handle icon click
|
|
3600
|
+
icon.addEventListener('mousedown', (e) => {
|
|
3601
|
+
e.preventDefault();
|
|
3602
|
+
e.stopPropagation();
|
|
3603
|
+
this.handleWarningClick(icon, newMatches, attachment.wrapper, fileName);
|
|
3604
|
+
});
|
|
3605
|
+
|
|
3606
|
+
// Apply styles if styleManager exists
|
|
3607
|
+
if (this.options.styleManager) {
|
|
3608
|
+
this.options.styleManager.applyIconStyles(icon);
|
|
3609
|
+
}
|
|
3610
|
+
|
|
3611
|
+
iconPlaceholder?.appendChild(icon);
|
|
3612
|
+
|
|
3613
|
+
if (this.options.debug) {
|
|
3614
|
+
console.log('[AttachmentManager] Added warning icon - new warnings detected');
|
|
3615
|
+
}
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
|
|
3569
3619
|
if (this.options.debug) {
|
|
3570
3620
|
console.log('[AttachmentManager] Updated CSV column', colIndex, 'to', headers[colIndex]);
|
|
3571
3621
|
}
|