@lvce-editor/extension-detail-view 3.12.0 → 3.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.
|
@@ -846,6 +846,8 @@ const WebWorkerRpcClient = {
|
|
|
846
846
|
create: create$2
|
|
847
847
|
};
|
|
848
848
|
|
|
849
|
+
const assetDir = '';
|
|
850
|
+
|
|
849
851
|
const create$1 = () => {
|
|
850
852
|
const states = Object.create(null);
|
|
851
853
|
return {
|
|
@@ -866,7 +868,7 @@ const {
|
|
|
866
868
|
set: set$1
|
|
867
869
|
} = create$1();
|
|
868
870
|
|
|
869
|
-
const create = (uid, uri, width, height, platform) => {
|
|
871
|
+
const create = (uid, uri, width, height, platform, assetDir$1) => {
|
|
870
872
|
const state = {
|
|
871
873
|
description: '',
|
|
872
874
|
iconSrc: '',
|
|
@@ -885,7 +887,8 @@ const create = (uid, uri, width, height, platform) => {
|
|
|
885
887
|
extension: {},
|
|
886
888
|
baseUrl: '',
|
|
887
889
|
features: [],
|
|
888
|
-
folderSize: 0
|
|
890
|
+
folderSize: 0,
|
|
891
|
+
assetDir: assetDir$1 || assetDir
|
|
889
892
|
};
|
|
890
893
|
set$1(uid, state, state);
|
|
891
894
|
};
|
|
@@ -1212,6 +1215,7 @@ const HandleClickDisable = 'handleClickDisable';
|
|
|
1212
1215
|
const HandleClickSize = 'handleClickSize';
|
|
1213
1216
|
const HandleClickUninstall = 'handleClickUninstall';
|
|
1214
1217
|
const HandleFeaturesClick = 'handleFeaturesClick';
|
|
1218
|
+
const HandleIconError = 'handleIconError';
|
|
1215
1219
|
const HandleReadmeContextMenu = 'handleReadmeContextMenu';
|
|
1216
1220
|
const HandleTabsClick = 'handleTabsClick';
|
|
1217
1221
|
|
|
@@ -2511,22 +2515,27 @@ const handleClickUninstall = async state => {
|
|
|
2511
2515
|
return state;
|
|
2512
2516
|
};
|
|
2513
2517
|
|
|
2514
|
-
const
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2518
|
+
const extensionDefaultIcon = assetDir => {
|
|
2519
|
+
return `${assetDir}/icons/extensionDefaultIcon.png`;
|
|
2520
|
+
};
|
|
2521
|
+
const extensionLanguageBasics = assetDir => {
|
|
2522
|
+
return `${assetDir}/icons/language-icon.svg`;
|
|
2523
|
+
};
|
|
2524
|
+
const extensionTheme = assetDir => {
|
|
2525
|
+
return `${assetDir}/icons/theme-icon.png`;
|
|
2526
|
+
};
|
|
2519
2527
|
|
|
2520
2528
|
const handleIconError = state => {
|
|
2521
2529
|
const {
|
|
2522
|
-
iconSrc
|
|
2530
|
+
iconSrc,
|
|
2531
|
+
assetDir
|
|
2523
2532
|
} = state;
|
|
2524
|
-
if (iconSrc ===
|
|
2533
|
+
if (iconSrc === extensionDefaultIcon(assetDir)) {
|
|
2525
2534
|
return state;
|
|
2526
2535
|
}
|
|
2527
2536
|
return {
|
|
2528
2537
|
...state,
|
|
2529
|
-
iconSrc:
|
|
2538
|
+
iconSrc: extensionDefaultIcon(assetDir)
|
|
2530
2539
|
};
|
|
2531
2540
|
};
|
|
2532
2541
|
|
|
@@ -5127,18 +5136,18 @@ const Web = 1;
|
|
|
5127
5136
|
const Electron = 2;
|
|
5128
5137
|
const Remote = 3;
|
|
5129
5138
|
|
|
5130
|
-
const getIcon = (extension, platform) => {
|
|
5139
|
+
const getIcon = (extension, platform, assetDir) => {
|
|
5131
5140
|
if (!extension) {
|
|
5132
|
-
return
|
|
5141
|
+
return extensionDefaultIcon(assetDir);
|
|
5133
5142
|
}
|
|
5134
5143
|
if (!extension.path || !extension.icon) {
|
|
5135
5144
|
if (isLanguageBasicsExtension(extension)) {
|
|
5136
|
-
return
|
|
5145
|
+
return extensionLanguageBasics(assetDir);
|
|
5137
5146
|
}
|
|
5138
5147
|
if (isThemeExtension(extension)) {
|
|
5139
|
-
return
|
|
5148
|
+
return extensionTheme(assetDir);
|
|
5140
5149
|
}
|
|
5141
|
-
return
|
|
5150
|
+
return extensionDefaultIcon(assetDir);
|
|
5142
5151
|
}
|
|
5143
5152
|
if (platform === Remote || platform === Electron) {
|
|
5144
5153
|
if (extension.builtin) {
|
|
@@ -5262,7 +5271,8 @@ const loadReadmeContent = async path => {
|
|
|
5262
5271
|
const loadContent = async (state, platform, savedState) => {
|
|
5263
5272
|
const {
|
|
5264
5273
|
uri,
|
|
5265
|
-
width
|
|
5274
|
+
width,
|
|
5275
|
+
assetDir
|
|
5266
5276
|
} = state;
|
|
5267
5277
|
const id = uri.slice('extension-detail://'.length);
|
|
5268
5278
|
const extension = await getExtension(id, platform);
|
|
@@ -5273,7 +5283,7 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
5273
5283
|
});
|
|
5274
5284
|
const sanitizedReadmeHtml = readmeHtml;
|
|
5275
5285
|
const normalizedReadmeHtml = sanitizedReadmeHtml;
|
|
5276
|
-
const iconSrc = getIcon(extension, platform);
|
|
5286
|
+
const iconSrc = getIcon(extension, platform, assetDir);
|
|
5277
5287
|
const description = getDescription(extension);
|
|
5278
5288
|
const name = getName(extension);
|
|
5279
5289
|
const size = getViewletSize(width);
|
|
@@ -5334,6 +5344,31 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
5334
5344
|
};
|
|
5335
5345
|
};
|
|
5336
5346
|
|
|
5347
|
+
const renderEventListeners = () => {
|
|
5348
|
+
return [{
|
|
5349
|
+
name: HandleIconError,
|
|
5350
|
+
params: ['handleIconError']
|
|
5351
|
+
}, {
|
|
5352
|
+
name: HandleReadmeContextMenu,
|
|
5353
|
+
params: ['handleReadmeContextMenu', 'event.clientX', 'event.clientY', 'event.target.href', 'event.target.src']
|
|
5354
|
+
}, {
|
|
5355
|
+
name: HandleTabsClick,
|
|
5356
|
+
params: ['handleTabsClick', 'event.target.name']
|
|
5357
|
+
}, {
|
|
5358
|
+
name: HandleFeaturesClick,
|
|
5359
|
+
params: ['handleFeaturesClick', 'event.target.name']
|
|
5360
|
+
}, {
|
|
5361
|
+
name: HandleClickSize,
|
|
5362
|
+
params: ['handleClickSize', 'event.target.name']
|
|
5363
|
+
}, {
|
|
5364
|
+
name: HandleClickDisable,
|
|
5365
|
+
params: ['handleClickDisable']
|
|
5366
|
+
}, {
|
|
5367
|
+
name: HandleClickUninstall,
|
|
5368
|
+
params: ['handleClickUninstall']
|
|
5369
|
+
}];
|
|
5370
|
+
};
|
|
5371
|
+
|
|
5337
5372
|
const resize = (state, dimensions) => {
|
|
5338
5373
|
return {
|
|
5339
5374
|
...state,
|
|
@@ -5387,6 +5422,7 @@ const commandMap = {
|
|
|
5387
5422
|
'ExtensionDetail.handleIconError': wrapCommand(handleIconError),
|
|
5388
5423
|
'ExtensionDetail.handleTabsClick': wrapCommand(handleTabsClick),
|
|
5389
5424
|
'ExtensionDetail.loadContent': wrapCommand(loadContent),
|
|
5425
|
+
'ExtensionDetail.renderEventListeners': renderEventListeners,
|
|
5390
5426
|
'ExtensionDetail.resize': resize,
|
|
5391
5427
|
'ExtensionDetail.saveState': saveState,
|
|
5392
5428
|
'ExtensionDetail.selectTab': wrapCommand(selectTab),
|