@lvce-editor/extension-detail-view 5.12.0 → 5.14.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()
@@ -4472,6 +4475,9 @@ const restoreState = savedState => {
4472
4475
  };
4473
4476
  };
4474
4477
 
4478
+ const isEnabled = tab => {
4479
+ return tab.enabled;
4480
+ };
4475
4481
  const loadContent = async (state, platform, savedState, isTest = false) => {
4476
4482
  if (isTest) {
4477
4483
  savedState = undefined;
@@ -4505,6 +4511,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
4505
4511
  const readmeContent = hasReadme ? await loadReadmeContent(readmeUrl) : noReadmeFound();
4506
4512
  const baseUrl = getBaseUrl(extension.path, platform);
4507
4513
  const locationProtocol = location.protocol;
4514
+ const locationHost = location.host;
4508
4515
  const readmeHtml = await renderMarkdown(readmeContent, {
4509
4516
  baseUrl,
4510
4517
  commit,
@@ -4527,7 +4534,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
4527
4534
  const features = getFeatures(selectedFeature || Theme, extension);
4528
4535
  const hasFeatures = features.length > 0;
4529
4536
  const tabs = getTabs(selectedTab, hasReadme, hasFeatures, hasChangelog);
4530
- const enabledTabs = tabs.filter(tab => tab.enabled);
4537
+ const enabledTabs = tabs.filter(isEnabled);
4531
4538
  const sizeValue = getViewletSize(width || 0);
4532
4539
  const showSizeLink = platform !== Web$1;
4533
4540
  const {
@@ -4564,6 +4571,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
4564
4571
  hasReadme,
4565
4572
  iconSrc,
4566
4573
  installationEntries,
4574
+ locationHost,
4567
4575
  locationProtocol,
4568
4576
  marketplaceEntries,
4569
4577
  name,
@@ -4595,9 +4603,11 @@ const openUrl = async uri => {
4595
4603
 
4596
4604
  const openImageInNewTab = async state => {
4597
4605
  const {
4598
- iconSrc
4606
+ iconSrc,
4607
+ locationHost,
4608
+ locationProtocol
4599
4609
  } = state;
4600
- const absoluteIconSrc = getImageCopyUrl(iconSrc);
4610
+ const absoluteIconSrc = getImageCopyUrl(iconSrc, locationProtocol, locationHost);
4601
4611
  await openUrl(absoluteIconSrc);
4602
4612
  return state;
4603
4613
  };
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.14.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
  }