@lvce-editor/main-area-worker 9.38.1 → 9.40.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.
- package/dist/mainAreaWorkerMain.js +62 -16
- package/package.json +1 -1
|
@@ -6061,11 +6061,51 @@ const handleWorkspaceChange = async (state, _workspacePath, savedState) => {
|
|
|
6061
6061
|
};
|
|
6062
6062
|
};
|
|
6063
6063
|
|
|
6064
|
+
const getEditorInputUris = editorInput => {
|
|
6065
|
+
switch (editorInput?.type) {
|
|
6066
|
+
case 'diff-editor':
|
|
6067
|
+
return [editorInput.uriLeft, editorInput.uriRight];
|
|
6068
|
+
case 'editor':
|
|
6069
|
+
case 'image':
|
|
6070
|
+
case 'video':
|
|
6071
|
+
case 'webview':
|
|
6072
|
+
return [editorInput.uri];
|
|
6073
|
+
default:
|
|
6074
|
+
return [];
|
|
6075
|
+
}
|
|
6076
|
+
};
|
|
6077
|
+
const getChangedEditorUid = (editorUid, editorInput, uri, changedUris) => {
|
|
6078
|
+
if (editorUid === -1) {
|
|
6079
|
+
return undefined;
|
|
6080
|
+
}
|
|
6081
|
+
const uris = getEditorInputUris(editorInput);
|
|
6082
|
+
if (uris.some(editorUri => changedUris.has(editorUri)) || uris.length === 0 && uri && changedUris.has(uri)) {
|
|
6083
|
+
return editorUid;
|
|
6084
|
+
}
|
|
6085
|
+
return undefined;
|
|
6086
|
+
};
|
|
6087
|
+
const reloadChangedEditors = async (state, changed) => {
|
|
6088
|
+
if (changed.length === 0) {
|
|
6089
|
+
return;
|
|
6090
|
+
}
|
|
6091
|
+
const changedUris = new Set(changed);
|
|
6092
|
+
const editorUids = new Set();
|
|
6093
|
+
for (const group of state.layout.groups) {
|
|
6094
|
+
for (const tab of group.tabs) {
|
|
6095
|
+
const editorUid = getChangedEditorUid(tab.editorUid, tab.editorInput, tab.uri, changedUris);
|
|
6096
|
+
if (editorUid !== undefined) {
|
|
6097
|
+
editorUids.add(editorUid);
|
|
6098
|
+
}
|
|
6099
|
+
}
|
|
6100
|
+
}
|
|
6101
|
+
await Promise.allSettled(Array.from(editorUids, editorUid => invoke('Viewlet.reload', editorUid)));
|
|
6102
|
+
};
|
|
6064
6103
|
const handleWorkspaceRefresh = async (state, refresh = {}) => {
|
|
6065
6104
|
const changes = Array.isArray(refresh) ? {
|
|
6066
6105
|
deleted: refresh
|
|
6067
6106
|
} : refresh;
|
|
6068
6107
|
const {
|
|
6108
|
+
changed = [],
|
|
6069
6109
|
deleted = [],
|
|
6070
6110
|
renamed = []
|
|
6071
6111
|
} = changes;
|
|
@@ -6081,6 +6121,7 @@ const handleWorkspaceRefresh = async (state, refresh = {}) => {
|
|
|
6081
6121
|
}
|
|
6082
6122
|
}
|
|
6083
6123
|
}
|
|
6124
|
+
await reloadChangedEditors(newState, changed);
|
|
6084
6125
|
return newState;
|
|
6085
6126
|
};
|
|
6086
6127
|
const handleWorkspaceRefreshWithContext = async (context, refresh = {}) => {
|
|
@@ -7637,12 +7678,12 @@ const renderEventListeners = () => {
|
|
|
7637
7678
|
}];
|
|
7638
7679
|
};
|
|
7639
7680
|
|
|
7681
|
+
const textEditorEntry = {
|
|
7682
|
+
id: 'editor',
|
|
7683
|
+
label: 'Text Editor',
|
|
7684
|
+
type: 'editor'
|
|
7685
|
+
};
|
|
7640
7686
|
const getViewProviderEntries = async uri => {
|
|
7641
|
-
const textEditorEntry = {
|
|
7642
|
-
id: 'editor',
|
|
7643
|
-
label: 'Text Editor',
|
|
7644
|
-
type: 'editor'
|
|
7645
|
-
};
|
|
7646
7687
|
try {
|
|
7647
7688
|
const providers = await invoke('WebView.getEditorProviders');
|
|
7648
7689
|
const matchingProviders = providers.filter(provider => provider?.id && provider.selector?.some(selector => uri.endsWith(selector)));
|
|
@@ -7658,7 +7699,7 @@ const getViewProviderEntries = async uri => {
|
|
|
7658
7699
|
return [textEditorEntry];
|
|
7659
7700
|
}
|
|
7660
7701
|
};
|
|
7661
|
-
const reopenEditorWith = async context => {
|
|
7702
|
+
const reopenEditorWith = async (context, preferredEditorId) => {
|
|
7662
7703
|
const initialState = context.getState();
|
|
7663
7704
|
const {
|
|
7664
7705
|
activeGroupId,
|
|
@@ -7669,16 +7710,21 @@ const reopenEditorWith = async context => {
|
|
|
7669
7710
|
if (!initialTab?.uri) {
|
|
7670
7711
|
return;
|
|
7671
7712
|
}
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7713
|
+
let selected;
|
|
7714
|
+
if (preferredEditorId === textEditorEntry.id) {
|
|
7715
|
+
selected = textEditorEntry;
|
|
7716
|
+
} else {
|
|
7717
|
+
const entries = await getViewProviderEntries(initialTab.uri);
|
|
7718
|
+
const items = entries.map(entry => ({
|
|
7719
|
+
description: '',
|
|
7720
|
+
label: entry.label,
|
|
7721
|
+
value: entry
|
|
7722
|
+
}));
|
|
7723
|
+
selected = await invoke('ExtensionHostQuickPick.showQuickPick', {
|
|
7724
|
+
items,
|
|
7725
|
+
placeholder: 'Select Editor'
|
|
7726
|
+
});
|
|
7727
|
+
}
|
|
7682
7728
|
if (!selected) {
|
|
7683
7729
|
return;
|
|
7684
7730
|
}
|