@blocklet/pages-kit 0.5.41 → 0.5.42
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/lib/cjs/builtin/utils.js +6 -5
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/property.js +11 -0
- package/lib/esm/builtin/utils.js +6 -5
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/property.js +11 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/lib/types/types/core.d.ts +11 -0
- package/lib/types/types/state.d.ts +2 -15
- package/package.json +4 -4
package/lib/cjs/builtin/utils.js
CHANGED
|
@@ -16,11 +16,12 @@ function getComponentMountPoint(name) {
|
|
|
16
16
|
return globalThis.blocklet?.componentMountPoints.find((i) => i.name === name || i.did === name)?.mountPoint;
|
|
17
17
|
}
|
|
18
18
|
function getMediaKitAbsoluteUrl(url) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
if (url && url.startsWith('mediakit://') && typeof window !== 'undefined') {
|
|
20
|
+
const PREFIX = window.blocklet?.prefix || '/';
|
|
21
|
+
// 这里使用 Pages Kit DID,因为 Pages Kit /uploads 是 Media Kit /uploads 的超集
|
|
22
|
+
const PAGES_KIT_DID = 'z8iZiDFg3vkkrPwsiba1TLXy3H9XHzFERsP8o';
|
|
23
|
+
const PAGES_KIT_PREFIX = blocklet?.componentMountPoints.find((i) => i.did === PAGES_KIT_DID)?.mountPoint || (0, ufo_1.joinURL)(PREFIX, '/image-bin');
|
|
24
|
+
return window.location.origin + (0, ufo_1.joinURL)(PAGES_KIT_PREFIX, 'uploads', url.replace('mediakit://', ''));
|
|
24
25
|
}
|
|
25
26
|
return url;
|
|
26
27
|
}
|