@yomotech/view-toolkit 0.0.14 → 0.0.15
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.
|
@@ -2982,7 +2982,9 @@ class SideMenuComponent {
|
|
|
2982
2982
|
subMenu?.submenu.forEach((childMenu) => {
|
|
2983
2983
|
tasks.push((async () => {
|
|
2984
2984
|
try {
|
|
2985
|
-
|
|
2985
|
+
let projectName = `${this.tenantName}_${this.projectSeleted}`;
|
|
2986
|
+
const image = await this.couchdbService.getFileContentFromCouchDb(projectName, childMenu.icon);
|
|
2987
|
+
childMenu.icon = this.getMediaSrc(image);
|
|
2986
2988
|
}
|
|
2987
2989
|
catch (err) {
|
|
2988
2990
|
console.error("Failed to fetch icon:", err);
|
|
@@ -3087,7 +3089,9 @@ class SideMenuComponent {
|
|
|
3087
3089
|
if (childMenu.options && childMenu.options.setImageUrl) {
|
|
3088
3090
|
tasks.push((async () => {
|
|
3089
3091
|
try {
|
|
3090
|
-
|
|
3092
|
+
let projectName = `${this.tenantName}_${this.projectSeleted}`;
|
|
3093
|
+
const image = await this.couchdbService.getFileContentFromCouchDb(projectName, childMenu.icon);
|
|
3094
|
+
childMenu.icon = this.getMediaSrc(image);
|
|
3091
3095
|
}
|
|
3092
3096
|
catch (err) {
|
|
3093
3097
|
console.error("Failed to fetch icon:", err);
|
|
@@ -3101,6 +3105,24 @@ class SideMenuComponent {
|
|
|
3101
3105
|
}
|
|
3102
3106
|
this.settingMenu = JSON.parse(JSON.stringify(this.settings));
|
|
3103
3107
|
}
|
|
3108
|
+
getMediaSrc(file) {
|
|
3109
|
+
if (!file)
|
|
3110
|
+
return '';
|
|
3111
|
+
// Best case: service already returns full data URL
|
|
3112
|
+
if (file.src) {
|
|
3113
|
+
return file.src;
|
|
3114
|
+
}
|
|
3115
|
+
// If service returns raw base64 + mimeType
|
|
3116
|
+
if (file.base64) {
|
|
3117
|
+
const mimeType = file.mimeType || 'image/png';
|
|
3118
|
+
return `data:${mimeType};base64,${file.base64}`;
|
|
3119
|
+
}
|
|
3120
|
+
// If service returns old dataUrl format
|
|
3121
|
+
if (file.dataUrl) {
|
|
3122
|
+
return file.dataUrl;
|
|
3123
|
+
}
|
|
3124
|
+
return '';
|
|
3125
|
+
}
|
|
3104
3126
|
isUrl(value) {
|
|
3105
3127
|
return /^https?:\/\//.test(value) || value.startsWith('blob:');
|
|
3106
3128
|
}
|