@lvce-editor/api 9.35.4 → 9.35.6
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.
|
@@ -52,11 +52,26 @@ export const readFile = async (uri) => {
|
|
|
52
52
|
return FileSystemWorker.readFile(uri);
|
|
53
53
|
};
|
|
54
54
|
export const readFileAsBlob = async (uri) => {
|
|
55
|
+
if (uri.startsWith('html://')) {
|
|
56
|
+
const url = await getObjectUrl(uri);
|
|
57
|
+
try {
|
|
58
|
+
const response = await fetch(url);
|
|
59
|
+
return await response.blob();
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
URL.revokeObjectURL(url);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
55
65
|
try {
|
|
56
66
|
return (await executeCommand('FileSystem.getBlob', uri));
|
|
57
67
|
}
|
|
58
68
|
catch {
|
|
59
|
-
|
|
69
|
+
try {
|
|
70
|
+
return await FileSystemWorker.invoke('FileSystem.getBlob', uri);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return FileSystemWorker.invoke('FileSystem.readFileAsBlob', uri);
|
|
74
|
+
}
|
|
60
75
|
}
|
|
61
76
|
};
|
|
62
77
|
export const readAsObjectUrl = async (uri) => {
|