tantee-nuxt-commons 0.0.165 → 0.0.167
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/module.json
CHANGED
|
@@ -41,11 +41,20 @@ const signatureOptions = computed(() => ({
|
|
|
41
41
|
// internal normalized value
|
|
42
42
|
const normalized = ref<Base64Asset | null>(null)
|
|
43
43
|
const imageDataUrl = computed(() => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const val = normalized.value
|
|
45
|
+
if (!val?.base64String) return null
|
|
46
|
+
|
|
47
|
+
const base = val.base64String.trim()
|
|
48
|
+
|
|
49
|
+
if (base.startsWith("data:")) {
|
|
50
|
+
return base
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const mime = (val as Base64File).fileType || "image/png"
|
|
54
|
+
return `data:${mime};base64,${base}`
|
|
47
55
|
})
|
|
48
56
|
|
|
57
|
+
|
|
49
58
|
// guards
|
|
50
59
|
let syncing = false // block re-entrancy while normalizing/hydrating
|
|
51
60
|
|
|
@@ -83,7 +83,7 @@ export const useAssetFile = () => {
|
|
|
83
83
|
fileName: file.name,
|
|
84
84
|
originalFileName: file.name,
|
|
85
85
|
base64String: dataUrl,
|
|
86
|
-
|
|
86
|
+
fileType: file.type || parseDataUrl(dataUrl)?.contentType
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
89
|
reader.onerror = reject;
|