cloud-ide-element 1.0.63 → 1.0.65

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.
@@ -4469,6 +4469,7 @@ class CideEleFileImageDirective {
4469
4469
  altText = 'Image';
4470
4470
  fileManagerService = inject(CideEleFileManagerService);
4471
4471
  elementRef = inject(ElementRef);
4472
+ destroyRef = inject(DestroyRef);
4472
4473
  ngOnInit() {
4473
4474
  this.loadImage();
4474
4475
  }
@@ -4480,7 +4481,7 @@ class CideEleFileImageDirective {
4480
4481
  return;
4481
4482
  }
4482
4483
  console.log('🖼️ [FileImageDirective] Loading image for ID:', this.fileId);
4483
- this.fileManagerService.getFileDetails({ cyfm_id: this.fileId }).pipe(takeUntilDestroyed()).subscribe({
4484
+ this.fileManagerService.getFileDetails({ cyfm_id: this.fileId }).pipe(takeUntilDestroyed(this.destroyRef)).subscribe({
4484
4485
  next: (fileDetails) => {
4485
4486
  console.log('📋 [FileImageDirective] File details received:', fileDetails);
4486
4487
  if (fileDetails?.data?.length) {
@@ -4498,47 +4499,21 @@ class CideEleFileImageDirective {
4498
4499
  }
4499
4500
  displayImage(fileData) {
4500
4501
  const imgElement = this.elementRef.nativeElement;
4501
- // Check if it's an image file
4502
- const isImage = this.isImageFile(fileData.cyfm_name || '', fileData.cyfm_type || '');
4503
- if (isImage) {
4504
- // For now, we'll use a placeholder or the file path
4505
- // In a real implementation, you might need to fetch the actual file content
4506
- if (fileData.cyfm_path) {
4507
- // If you have a direct URL to the file, use it
4508
- imgElement.src = fileData.cyfm_path;
4509
- imgElement.alt = fileData.cyfm_alt_text || this.altText;
4510
- console.log('✅ [FileImageDirective] Image loaded from path:', fileData.cyfm_path);
4511
- }
4512
- else if (fileData.cyfm_file_base64) {
4513
- // If base64 data is available, use it
4514
- let base64Data = fileData.cyfm_file_base64;
4515
- if (!base64Data.startsWith('data:')) {
4516
- const mimeType = fileData.cyfm_type || 'image/jpeg';
4517
- base64Data = `data:${mimeType};base64,${base64Data}`;
4518
- }
4519
- imgElement.src = base64Data;
4520
- imgElement.alt = fileData.cyfm_alt_text || this.altText;
4521
- console.log('✅ [FileImageDirective] Image loaded from base64 data');
4522
- }
4523
- else {
4524
- console.warn('⚠️ [FileImageDirective] No image data available for file:', fileData.cyfm_name);
4502
+ // Use base64 data directly
4503
+ if (fileData.cyfm_file_base64) {
4504
+ let base64Data = fileData.cyfm_file_base64;
4505
+ if (!base64Data.startsWith('data:')) {
4506
+ const mimeType = fileData.cyfm_type || 'image/jpeg';
4507
+ base64Data = `data:${mimeType};base64,${base64Data}`;
4525
4508
  }
4509
+ imgElement.src = base64Data;
4510
+ imgElement.alt = fileData.cyfm_alt_text || this.altText;
4511
+ console.log('✅ [FileImageDirective] Image loaded from base64 data');
4526
4512
  }
4527
4513
  else {
4528
- console.warn('⚠️ [FileImageDirective] File is not an image:', fileData.cyfm_name);
4514
+ console.warn('⚠️ [FileImageDirective] No base64 data available for file');
4529
4515
  }
4530
4516
  }
4531
- isImageFile(fileName, fileType) {
4532
- if (fileType && fileType.startsWith('image/')) {
4533
- return true;
4534
- }
4535
- if (fileName) {
4536
- const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp', '.svg'];
4537
- const lowerFileName = fileName.toLowerCase();
4538
- return imageExtensions.some(ext => lowerFileName.endsWith(ext));
4539
- }
4540
- return false;
4541
- }
4542
4517
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideEleFileImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4543
4518
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.7", type: CideEleFileImageDirective, isStandalone: true, selector: "[cideEleFileImage]", inputs: { fileId: "fileId", altText: "altText" }, ngImport: i0 });
4544
4519
  }