@lvce-editor/main-area-worker 9.54.0 → 9.54.1
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.
- package/dist/mainAreaWorkerMain.js +49 -13
- package/package.json +1 -1
|
@@ -3770,6 +3770,33 @@ const getLabel = uri => {
|
|
|
3770
3770
|
return getBasename$1(uri);
|
|
3771
3771
|
};
|
|
3772
3772
|
|
|
3773
|
+
/**
|
|
3774
|
+
*
|
|
3775
|
+
* @param {string} uri
|
|
3776
|
+
* @returns
|
|
3777
|
+
*/
|
|
3778
|
+
const getFileIcon = uri => {
|
|
3779
|
+
if (uri === 'app://keybindings') {
|
|
3780
|
+
return `MaskIconRecordKey`;
|
|
3781
|
+
}
|
|
3782
|
+
if (uri.startsWith('extension-detail://')) {
|
|
3783
|
+
return `MaskIconExtensions`;
|
|
3784
|
+
}
|
|
3785
|
+
if (uri.startsWith('process-explorer://')) {
|
|
3786
|
+
return `MaskIconDebugAlt2`;
|
|
3787
|
+
}
|
|
3788
|
+
if (uri.startsWith('running-extensions://')) {
|
|
3789
|
+
return `MaskIconExtensions`;
|
|
3790
|
+
}
|
|
3791
|
+
if (uri.startsWith('cookie-import-view://')) {
|
|
3792
|
+
return `MaskIconRecordKey`;
|
|
3793
|
+
}
|
|
3794
|
+
if (uri.startsWith('search-editor://')) {
|
|
3795
|
+
return `MaskIconSearch`;
|
|
3796
|
+
}
|
|
3797
|
+
return '';
|
|
3798
|
+
};
|
|
3799
|
+
|
|
3773
3800
|
const getEditorInputTitle = editorInput => {
|
|
3774
3801
|
switch (editorInput.type) {
|
|
3775
3802
|
case 'binary':
|
|
@@ -4165,31 +4192,40 @@ const getFileIconsForTabs = async (tabs, fileIconCache) => {
|
|
|
4165
4192
|
};
|
|
4166
4193
|
};
|
|
4167
4194
|
|
|
4195
|
+
const updateIcon = (state, tabId, icon) => {
|
|
4196
|
+
return {
|
|
4197
|
+
...state,
|
|
4198
|
+
layout: {
|
|
4199
|
+
...state.layout,
|
|
4200
|
+
groups: state.layout.groups.map(group => ({
|
|
4201
|
+
...group,
|
|
4202
|
+
tabs: group.tabs.map(tab => tab.id === tabId ? {
|
|
4203
|
+
...tab,
|
|
4204
|
+
icon
|
|
4205
|
+
} : tab)
|
|
4206
|
+
}))
|
|
4207
|
+
}
|
|
4208
|
+
};
|
|
4209
|
+
};
|
|
4168
4210
|
const updateTabIcon = async (context, readyState, tabId) => {
|
|
4169
4211
|
const newTab = findTabById(readyState, tabId);
|
|
4170
4212
|
if (!newTab || !newTab.tab.uri) {
|
|
4171
4213
|
return undefined;
|
|
4172
4214
|
}
|
|
4215
|
+
const builtInIcon = getFileIcon(newTab.tab.uri);
|
|
4216
|
+
if (builtInIcon) {
|
|
4217
|
+
return context.updateState(state => updateIcon(state, tabId, builtInIcon));
|
|
4218
|
+
}
|
|
4173
4219
|
try {
|
|
4174
4220
|
const {
|
|
4175
4221
|
newFileIconCache
|
|
4176
4222
|
} = await getFileIconsForTabs([newTab.tab], readyState.fileIconCache);
|
|
4177
4223
|
const stateBeforeIconUpdate = context.getState();
|
|
4178
4224
|
const icon = newFileIconCache[newTab.tab.uri] || '';
|
|
4179
|
-
const stateWithIcon = {
|
|
4225
|
+
const stateWithIcon = updateIcon({
|
|
4180
4226
|
...stateBeforeIconUpdate,
|
|
4181
|
-
fileIconCache: newFileIconCache
|
|
4182
|
-
|
|
4183
|
-
...stateBeforeIconUpdate.layout,
|
|
4184
|
-
groups: stateBeforeIconUpdate.layout.groups.map(group => ({
|
|
4185
|
-
...group,
|
|
4186
|
-
tabs: group.tabs.map(tab => tab.id === tabId ? {
|
|
4187
|
-
...tab,
|
|
4188
|
-
icon
|
|
4189
|
-
} : tab)
|
|
4190
|
-
}))
|
|
4191
|
-
}
|
|
4192
|
-
};
|
|
4227
|
+
fileIconCache: newFileIconCache
|
|
4228
|
+
}, tabId, icon);
|
|
4193
4229
|
return context.updateState(() => stateWithIcon);
|
|
4194
4230
|
} catch {
|
|
4195
4231
|
return undefined;
|