@blocklet/pages-kit 0.5.41 → 0.5.43

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.
@@ -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
- const PREFIX = window.blocklet?.prefix || '/';
20
- const IMAGE_BIN_DID = 'z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9';
21
- const IMAGE_BIN_PREFIX = blocklet?.componentMountPoints.find((i) => i.did === IMAGE_BIN_DID)?.mountPoint || (0, ufo_1.joinURL)(PREFIX, '/image-bin');
22
- if (url && url.startsWith('mediakit://')) {
23
- return window.location.origin + (0, ufo_1.joinURL)(IMAGE_BIN_PREFIX, 'uploads', url.replace('mediakit://', ''));
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
  }