cloud-ide-element 1.1.142 → 1.1.144
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.
|
@@ -9533,14 +9533,37 @@ class CideEleFileImageDirective {
|
|
|
9533
9533
|
fileManagerService = inject(CideEleFileManagerService);
|
|
9534
9534
|
elementRef = inject(ElementRef);
|
|
9535
9535
|
destroyRef = inject(DestroyRef);
|
|
9536
|
+
previousFileId = null;
|
|
9536
9537
|
ngOnInit() {
|
|
9537
9538
|
this.loadImage();
|
|
9539
|
+
this.previousFileId = this.fileId;
|
|
9540
|
+
}
|
|
9541
|
+
ngOnChanges(changes) {
|
|
9542
|
+
// Check if fileId has changed
|
|
9543
|
+
if (changes['fileId'] && !changes['fileId'].firstChange) {
|
|
9544
|
+
const currentFileId = changes['fileId'].currentValue;
|
|
9545
|
+
const previousFileId = changes['fileId'].previousValue;
|
|
9546
|
+
// Only reload if the fileId actually changed
|
|
9547
|
+
if (currentFileId !== previousFileId) {
|
|
9548
|
+
console.log('🔄 [FileImageDirective] File ID changed from', previousFileId, 'to', currentFileId);
|
|
9549
|
+
this.previousFileId = currentFileId;
|
|
9550
|
+
// If fileId is null or empty, clear the image
|
|
9551
|
+
if (!currentFileId || currentFileId.trim() === '') {
|
|
9552
|
+
this.clearImage();
|
|
9553
|
+
}
|
|
9554
|
+
else {
|
|
9555
|
+
// Load the new image
|
|
9556
|
+
this.loadImage();
|
|
9557
|
+
}
|
|
9558
|
+
}
|
|
9559
|
+
}
|
|
9538
9560
|
}
|
|
9539
9561
|
ngOnDestroy() {
|
|
9540
9562
|
// Cleanup handled by takeUntilDestroyed
|
|
9541
9563
|
}
|
|
9542
9564
|
loadImage() {
|
|
9543
|
-
if (!this.fileId) {
|
|
9565
|
+
if (!this.fileId || this.fileId.trim() === '') {
|
|
9566
|
+
this.clearImage();
|
|
9544
9567
|
return;
|
|
9545
9568
|
}
|
|
9546
9569
|
console.log('🖼️ [FileImageDirective] Loading image for ID:', this.fileId);
|
|
@@ -9553,13 +9576,21 @@ class CideEleFileImageDirective {
|
|
|
9553
9576
|
}
|
|
9554
9577
|
else {
|
|
9555
9578
|
console.warn('⚠️ [FileImageDirective] No file data found for ID:', this.fileId);
|
|
9579
|
+
this.clearImage();
|
|
9556
9580
|
}
|
|
9557
9581
|
},
|
|
9558
9582
|
error: (error) => {
|
|
9559
9583
|
console.error('❌ [FileImageDirective] Error loading file details:', error);
|
|
9584
|
+
this.clearImage();
|
|
9560
9585
|
}
|
|
9561
9586
|
});
|
|
9562
9587
|
}
|
|
9588
|
+
clearImage() {
|
|
9589
|
+
const imgElement = this.elementRef.nativeElement;
|
|
9590
|
+
imgElement.src = '';
|
|
9591
|
+
imgElement.alt = this.altText;
|
|
9592
|
+
console.log('🧹 [FileImageDirective] Image cleared');
|
|
9593
|
+
}
|
|
9563
9594
|
displayImage(fileData) {
|
|
9564
9595
|
const imgElement = this.elementRef.nativeElement;
|
|
9565
9596
|
// Use base64 data directly
|
|
@@ -9578,7 +9609,7 @@ class CideEleFileImageDirective {
|
|
|
9578
9609
|
}
|
|
9579
9610
|
}
|
|
9580
9611
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CideEleFileImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
9581
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.15", type: CideEleFileImageDirective, isStandalone: true, selector: "[cideEleFileImage]", inputs: { fileId: "fileId", altText: "altText" }, ngImport: i0 });
|
|
9612
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.15", type: CideEleFileImageDirective, isStandalone: true, selector: "[cideEleFileImage]", inputs: { fileId: "fileId", altText: "altText" }, usesOnChanges: true, ngImport: i0 });
|
|
9582
9613
|
}
|
|
9583
9614
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CideEleFileImageDirective, decorators: [{
|
|
9584
9615
|
type: Directive,
|