slidev-workspace 0.5.0 → 0.5.1
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/index.js
CHANGED
|
@@ -80,7 +80,7 @@ function resolveImageUrl(slide, domain) {
|
|
|
80
80
|
if (background) {
|
|
81
81
|
if (isUrl(background)) return background;
|
|
82
82
|
try {
|
|
83
|
-
return IS_DEVELOPMENT ? new URL(background, domain).href : new URL(pathJoin(baseUrl, slidePath, background), domain).href;
|
|
83
|
+
return IS_DEVELOPMENT ? new URL(pathJoin(slidePath, background), domain).href : new URL(pathJoin(baseUrl, slidePath, background), domain).href;
|
|
84
84
|
} catch (error) {
|
|
85
85
|
console.error("Failed to resolve background path:", error);
|
|
86
86
|
return "https://cover.sli.dev";
|
package/package.json
CHANGED
|
@@ -115,7 +115,9 @@ describe("resolveImageUrl (Development Mode)", () => {
|
|
|
115
115
|
|
|
116
116
|
const result = resolveImageUrl(slide, domain);
|
|
117
117
|
|
|
118
|
-
expect(result).toBe(
|
|
118
|
+
expect(result).toBe(
|
|
119
|
+
"http://localhost:3001/slides-presentation-1/background.jpg",
|
|
120
|
+
);
|
|
119
121
|
});
|
|
120
122
|
|
|
121
123
|
it("should return default cover when no image sources provided", async () => {
|
|
@@ -72,7 +72,7 @@ export function resolveImageUrl(slide: SlideInfo, domain: string): string {
|
|
|
72
72
|
|
|
73
73
|
try {
|
|
74
74
|
return IS_DEVELOPMENT
|
|
75
|
-
? new URL(background, domain).href
|
|
75
|
+
? new URL(pathJoin(slidePath, background), domain).href
|
|
76
76
|
: new URL(pathJoin(baseUrl, slidePath, background), domain).href;
|
|
77
77
|
} catch (error) {
|
|
78
78
|
console.error("Failed to resolve background path:", error);
|