@lvce-editor/extension-detail-view 5.12.0 → 5.13.0

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.
@@ -3048,19 +3048,19 @@ const readFileAsBlob = async uri => {
3048
3048
  return invoke('FileSystem.readFileAsBlob', uri);
3049
3049
  };
3050
3050
 
3051
- const getImageCopyUrl = iconSrc => {
3052
- // TODO support gitpod url prefixes
3053
- // @ts-ignore
3054
- const prefix = `${location.protocol}//${location.host}`;
3051
+ const getImageCopyUrl = (iconSrc, locationProtocol, locationHost) => {
3052
+ const prefix = `${locationProtocol}//${locationHost}`;
3055
3053
  const absoluteIconSrc = `${prefix}${iconSrc}`;
3056
3054
  return absoluteIconSrc;
3057
3055
  };
3058
3056
 
3059
3057
  const copyImage = async state => {
3060
3058
  const {
3061
- iconSrc
3059
+ iconSrc,
3060
+ locationHost,
3061
+ locationProtocol
3062
3062
  } = state;
3063
- const absoluteIconSrc = getImageCopyUrl(iconSrc);
3063
+ const absoluteIconSrc = getImageCopyUrl(iconSrc, locationProtocol, locationHost);
3064
3064
  const blob = await readFileAsBlob(absoluteIconSrc);
3065
3065
  await writeClipboardImage(blob);
3066
3066
  return state;
@@ -3068,9 +3068,11 @@ const copyImage = async state => {
3068
3068
 
3069
3069
  const copyImageUrl = async state => {
3070
3070
  const {
3071
- iconSrc
3071
+ iconSrc,
3072
+ locationHost,
3073
+ locationProtocol
3072
3074
  } = state;
3073
- const absoluteIconSrc = getImageCopyUrl(iconSrc);
3075
+ const absoluteIconSrc = getImageCopyUrl(iconSrc, locationProtocol, locationHost);
3074
3076
  await writeText(absoluteIconSrc);
3075
3077
  return state;
3076
3078
  };
@@ -3124,6 +3126,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
3124
3126
  importTime: 0,
3125
3127
  installationEntries: [],
3126
3128
  jsonValidation: [],
3129
+ locationHost: '',
3127
3130
  locationProtocol: '',
3128
3131
  marketplaceEntries: [],
3129
3132
  name: '',
@@ -3234,8 +3237,8 @@ const getMenuEntries2 = (state, props) => {
3234
3237
  }
3235
3238
  if (props.menuId === ExtensionDetailReadme && props.href) {
3236
3239
  return [{
3237
- args: [],
3238
- command: 'ExtensionDetail.copyLink',
3240
+ args: [props.href],
3241
+ command: 'ExtensionDetail.copyReadmeLink',
3239
3242
  flags: None$2,
3240
3243
  id: 'copyLink',
3241
3244
  label: copyLink()
@@ -4505,6 +4508,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
4505
4508
  const readmeContent = hasReadme ? await loadReadmeContent(readmeUrl) : noReadmeFound();
4506
4509
  const baseUrl = getBaseUrl(extension.path, platform);
4507
4510
  const locationProtocol = location.protocol;
4511
+ const locationHost = location.host;
4508
4512
  const readmeHtml = await renderMarkdown(readmeContent, {
4509
4513
  baseUrl,
4510
4514
  commit,
@@ -4564,6 +4568,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
4564
4568
  hasReadme,
4565
4569
  iconSrc,
4566
4570
  installationEntries,
4571
+ locationHost,
4567
4572
  locationProtocol,
4568
4573
  marketplaceEntries,
4569
4574
  name,
@@ -4595,9 +4600,11 @@ const openUrl = async uri => {
4595
4600
 
4596
4601
  const openImageInNewTab = async state => {
4597
4602
  const {
4598
- iconSrc
4603
+ iconSrc,
4604
+ locationHost,
4605
+ locationProtocol
4599
4606
  } = state;
4600
- const absoluteIconSrc = getImageCopyUrl(iconSrc);
4607
+ const absoluteIconSrc = getImageCopyUrl(iconSrc, locationProtocol, locationHost);
4601
4608
  await openUrl(absoluteIconSrc);
4602
4609
  return state;
4603
4610
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "5.12.0",
3
+ "version": "5.13.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,6 +11,6 @@
11
11
  "type": "module",
12
12
  "main": "dist/extensionDetailViewWorkerMain.js",
13
13
  "dependencies": {
14
- "@lvce-editor/constants": "^1.41.0"
14
+ "@lvce-editor/constants": "^1.42.0"
15
15
  }
16
16
  }