@lvce-editor/extension-detail-view 6.2.0 → 6.3.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.
|
@@ -1027,6 +1027,7 @@ const ExtensionDetailIconContextMenu$3 = 4091;
|
|
|
1027
1027
|
const None$2 = 0;
|
|
1028
1028
|
|
|
1029
1029
|
const Web$1 = 1;
|
|
1030
|
+
const Electron$1 = 2;
|
|
1030
1031
|
|
|
1031
1032
|
const ExtensionHostWorker = 44;
|
|
1032
1033
|
const ExtensionManagementWorker = 9006;
|
|
@@ -2337,7 +2338,7 @@ const setExtensionsSearchValue = async searchValue => {
|
|
|
2337
2338
|
// @ts-ignore
|
|
2338
2339
|
return invoke$1('Extensions.handleInput', searchValue, Script$1);
|
|
2339
2340
|
};
|
|
2340
|
-
const openUrl
|
|
2341
|
+
const openUrl = async uri => {
|
|
2341
2342
|
// @ts-ignore
|
|
2342
2343
|
await invoke$1('Open.openUrl', uri);
|
|
2343
2344
|
};
|
|
@@ -3137,6 +3138,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
3137
3138
|
importTime: 0,
|
|
3138
3139
|
installationEntries: [],
|
|
3139
3140
|
jsonValidation: [],
|
|
3141
|
+
linkProtectionEnabled: false,
|
|
3140
3142
|
locationHost: '',
|
|
3141
3143
|
locationProtocol: '',
|
|
3142
3144
|
marketplaceEntries: [],
|
|
@@ -4326,6 +4328,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4326
4328
|
name,
|
|
4327
4329
|
paddingLeft: padding,
|
|
4328
4330
|
paddingRight: padding,
|
|
4331
|
+
platform,
|
|
4329
4332
|
rating,
|
|
4330
4333
|
readmeScrollTop,
|
|
4331
4334
|
readmeUrl,
|
|
@@ -4386,17 +4389,40 @@ const handleImageContextMenu = async (state, eventX, eventY) => {
|
|
|
4386
4389
|
return state;
|
|
4387
4390
|
};
|
|
4388
4391
|
|
|
4392
|
+
const openExternal = async (uri, platform) => {
|
|
4393
|
+
if (platform === Electron$1) ; else {
|
|
4394
|
+
await openUrl(uri);
|
|
4395
|
+
}
|
|
4396
|
+
};
|
|
4397
|
+
|
|
4398
|
+
const handleReadmeLinkClick = async (linkProtectionEnabled, platform, href) => {
|
|
4399
|
+
// TODO what to do about relative links? open them in editor?
|
|
4400
|
+
// TODO what to do about mail links?
|
|
4401
|
+
if (linkProtectionEnabled) {
|
|
4402
|
+
const message = `Do you want to open this external link?\n\n${href}`;
|
|
4403
|
+
const confirmed = await confirm(message);
|
|
4404
|
+
if (!confirmed) {
|
|
4405
|
+
return;
|
|
4406
|
+
}
|
|
4407
|
+
}
|
|
4408
|
+
await openExternal(href, platform);
|
|
4409
|
+
return;
|
|
4410
|
+
};
|
|
4411
|
+
|
|
4389
4412
|
const isExternalLink = href => {
|
|
4390
4413
|
return href.startsWith('http://') || href.startsWith('https://');
|
|
4391
4414
|
};
|
|
4392
4415
|
const handleReadmeClick = async (state, nodeName, href) => {
|
|
4416
|
+
const {
|
|
4417
|
+
linkProtectionEnabled,
|
|
4418
|
+
platform
|
|
4419
|
+
} = state;
|
|
4393
4420
|
if (!href || !isExternalLink(href)) {
|
|
4394
4421
|
return state;
|
|
4395
4422
|
}
|
|
4396
4423
|
// TODO what to do about relative links? open them in editor?
|
|
4397
4424
|
// TODO what to do about mail links?
|
|
4398
|
-
await
|
|
4399
|
-
// TODO check node name and href
|
|
4425
|
+
await handleReadmeLinkClick(linkProtectionEnabled, platform, href);
|
|
4400
4426
|
return state;
|
|
4401
4427
|
};
|
|
4402
4428
|
|
|
@@ -4692,18 +4718,15 @@ const loadContent2 = async (state, savedState, isTest = false) => {
|
|
|
4692
4718
|
return loadContent(state, state.platform, savedState, isTest);
|
|
4693
4719
|
};
|
|
4694
4720
|
|
|
4695
|
-
const openUrl = async uri => {
|
|
4696
|
-
await openUrl$1(uri);
|
|
4697
|
-
};
|
|
4698
|
-
|
|
4699
4721
|
const openImageInNewTab = async state => {
|
|
4700
4722
|
const {
|
|
4701
4723
|
iconSrc,
|
|
4702
4724
|
locationHost,
|
|
4703
|
-
locationProtocol
|
|
4725
|
+
locationProtocol,
|
|
4726
|
+
platform
|
|
4704
4727
|
} = state;
|
|
4705
4728
|
const absoluteIconSrc = getImageCopyUrl(iconSrc, locationProtocol, locationHost);
|
|
4706
|
-
await
|
|
4729
|
+
await openExternal(absoluteIconSrc, platform);
|
|
4707
4730
|
return state;
|
|
4708
4731
|
};
|
|
4709
4732
|
|
|
@@ -5313,7 +5336,7 @@ const render2 = (uid, diffResult) => {
|
|
|
5313
5336
|
const renderEventListeners = () => {
|
|
5314
5337
|
return [{
|
|
5315
5338
|
name: HandleAdditionalDetailContextMenu,
|
|
5316
|
-
params: ['handleAdditionalDetailsContextMenu', ClientX, ClientY, 'event.target.nodeName',
|
|
5339
|
+
params: ['handleAdditionalDetailsContextMenu', ClientX, ClientY, 'event.target.nodeName', TargetHref],
|
|
5317
5340
|
preventDefault: true
|
|
5318
5341
|
}, {
|
|
5319
5342
|
name: HandleClickCategory,
|
|
@@ -5356,7 +5379,7 @@ const renderEventListeners = () => {
|
|
|
5356
5379
|
params: ['handleClickSettings']
|
|
5357
5380
|
}, {
|
|
5358
5381
|
name: HandleReadmeClick,
|
|
5359
|
-
params: ['handleReadmeClick', 'event.target.nodeName',
|
|
5382
|
+
params: ['handleReadmeClick', 'event.target.nodeName', TargetHref],
|
|
5360
5383
|
preventDefault: true
|
|
5361
5384
|
}, {
|
|
5362
5385
|
name: HandleClickUninstall,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/extension-detail-view",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.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": "^2.
|
|
14
|
+
"@lvce-editor/constants": "^2.4.0"
|
|
15
15
|
}
|
|
16
16
|
}
|