@lvce-editor/main-area-worker 9.38.0 → 9.39.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 +42 -1
- 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 = {}) => {
|
|
@@ -6264,7 +6305,7 @@ const getNewWindowMenuEntries = state => {
|
|
|
6264
6305
|
const getMenuEntries$2 = (state, groupId) => {
|
|
6265
6306
|
const groupArgs = getMenuEntryArgs(groupId);
|
|
6266
6307
|
const entries = [{
|
|
6267
|
-
command: '
|
|
6308
|
+
command: 'Main.newFile',
|
|
6268
6309
|
flags: None$1,
|
|
6269
6310
|
id: 'newTextFile',
|
|
6270
6311
|
label: newTextFile()
|