@lvce-editor/source-control-worker 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.
- package/dist/sourceControlWorkerMain.js +40 -10
- package/package.json +1 -1
|
@@ -2637,7 +2637,7 @@ const getKeyBindings = () => {
|
|
|
2637
2637
|
}];
|
|
2638
2638
|
};
|
|
2639
2639
|
|
|
2640
|
-
const getMenuEntries =
|
|
2640
|
+
const getMenuEntries = uri => {
|
|
2641
2641
|
return [{
|
|
2642
2642
|
command: /* TODO */'-1',
|
|
2643
2643
|
flags: None,
|
|
@@ -2669,9 +2669,10 @@ const getMenuEntries = () => {
|
|
|
2669
2669
|
id: '',
|
|
2670
2670
|
label: addToGitignore()
|
|
2671
2671
|
}, {
|
|
2672
|
-
|
|
2672
|
+
args: [uri],
|
|
2673
|
+
command: 'Source Control.revealInExplorer',
|
|
2673
2674
|
flags: None,
|
|
2674
|
-
id: '',
|
|
2675
|
+
id: 'revealInExplorerView',
|
|
2675
2676
|
label: revealInExplorerView()
|
|
2676
2677
|
}, {
|
|
2677
2678
|
command: /* TODO */'-1',
|
|
@@ -2681,8 +2682,8 @@ const getMenuEntries = () => {
|
|
|
2681
2682
|
}];
|
|
2682
2683
|
};
|
|
2683
2684
|
|
|
2684
|
-
const getMenuEntries2 = state => {
|
|
2685
|
-
return getMenuEntries();
|
|
2685
|
+
const getMenuEntries2 = (state, props) => {
|
|
2686
|
+
return getMenuEntries(props.uri);
|
|
2686
2687
|
};
|
|
2687
2688
|
|
|
2688
2689
|
const getMenuIds = () => {
|
|
@@ -3015,10 +3016,16 @@ const show2 = async (uid, menuId, x, y, args) => {
|
|
|
3015
3016
|
|
|
3016
3017
|
const handleContextMenu = async (state, button, x, y) => {
|
|
3017
3018
|
const {
|
|
3018
|
-
id
|
|
3019
|
+
id,
|
|
3020
|
+
items,
|
|
3021
|
+
root
|
|
3019
3022
|
} = state;
|
|
3023
|
+
const index = getIndex(state, x, y);
|
|
3024
|
+
const item = items[index];
|
|
3025
|
+
const uri = item?.file ? `${root}/${item.file}` : '';
|
|
3020
3026
|
await show2(id, SourceControl$1, x, y, {
|
|
3021
|
-
menuId: SourceControl$1
|
|
3027
|
+
menuId: SourceControl$1,
|
|
3028
|
+
uri
|
|
3022
3029
|
});
|
|
3023
3030
|
return state;
|
|
3024
3031
|
};
|
|
@@ -3095,9 +3102,19 @@ const set = rpc => {
|
|
|
3095
3102
|
state.connected = true;
|
|
3096
3103
|
};
|
|
3097
3104
|
|
|
3098
|
-
const handleRendererProcessMessagePort = async port => {
|
|
3105
|
+
const handleRendererProcessMessagePort = async (port, viewletCommandMap) => {
|
|
3106
|
+
const executeViewletCommand = async (uid, command, ...args) => {
|
|
3107
|
+
const fn = viewletCommandMap[`SourceControl.${command}`];
|
|
3108
|
+
if (typeof fn !== 'function') {
|
|
3109
|
+
throw new TypeError(`Viewlet command not found: ${command}`);
|
|
3110
|
+
}
|
|
3111
|
+
await fn(uid, ...args);
|
|
3112
|
+
await invoke$1('Viewlet.requestRender', uid);
|
|
3113
|
+
};
|
|
3099
3114
|
const rpc = await create$4({
|
|
3100
|
-
commandMap: {
|
|
3115
|
+
commandMap: {
|
|
3116
|
+
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
3117
|
+
},
|
|
3101
3118
|
messagePort: port
|
|
3102
3119
|
});
|
|
3103
3120
|
set(rpc);
|
|
@@ -3952,6 +3969,17 @@ const renderEventListeners = () => {
|
|
|
3952
3969
|
}];
|
|
3953
3970
|
};
|
|
3954
3971
|
|
|
3972
|
+
const revealInExplorer = async (state, uri) => {
|
|
3973
|
+
await invoke$1('SideBar.show', 'Explorer');
|
|
3974
|
+
const states = await invoke$1('Viewlet.getAllStates');
|
|
3975
|
+
const viewlets = Object.values(states);
|
|
3976
|
+
const sideBar = viewlets.find(viewlet => viewlet.currentViewletId === 'Explorer');
|
|
3977
|
+
const explorerUid = Math.max(...viewlets.filter(viewlet => viewlet.parentUid === sideBar.uid).map(viewlet => viewlet.uid));
|
|
3978
|
+
await invoke$1('Viewlet.executeViewletCommand', explorerUid, 'reveal', uri);
|
|
3979
|
+
await invoke$1('Viewlet.executeViewletCommand', explorerUid, 'refresh');
|
|
3980
|
+
return state;
|
|
3981
|
+
};
|
|
3982
|
+
|
|
3955
3983
|
const saveState = uid => {
|
|
3956
3984
|
number(uid);
|
|
3957
3985
|
const value = get(uid);
|
|
@@ -3996,6 +4024,7 @@ const viewAsList = state => {
|
|
|
3996
4024
|
};
|
|
3997
4025
|
};
|
|
3998
4026
|
|
|
4027
|
+
const handleDirectMessagePort = port => handleRendererProcessMessagePort(port, commandMap);
|
|
3999
4028
|
const commandMap = {
|
|
4000
4029
|
'Initialize.initialize': initialize,
|
|
4001
4030
|
'SourceControl.acceptInput': wrapCommand(acceptInput),
|
|
@@ -4024,7 +4053,7 @@ const commandMap = {
|
|
|
4024
4053
|
'SourceControl.handleMouseOutAt': wrapCommand(handleMouseOutAt),
|
|
4025
4054
|
'SourceControl.handleMouseOver': wrapCommand(handleMouseOver),
|
|
4026
4055
|
'SourceControl.handleMouseOverAt': wrapCommand(handleMouseOverAt),
|
|
4027
|
-
'SourceControl.handleRendererProcessMessagePort':
|
|
4056
|
+
'SourceControl.handleRendererProcessMessagePort': handleDirectMessagePort,
|
|
4028
4057
|
'SourceControl.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
|
|
4029
4058
|
'SourceControl.handleScrollBarClick': wrapCommand(handleScrollBarClick),
|
|
4030
4059
|
'SourceControl.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|
|
@@ -4037,6 +4066,7 @@ const commandMap = {
|
|
|
4037
4066
|
'SourceControl.renderActions': wrapGetter(renderActions),
|
|
4038
4067
|
'SourceControl.renderActions2': renderActions,
|
|
4039
4068
|
'SourceControl.renderEventListeners': renderEventListeners,
|
|
4069
|
+
'SourceControl.revealInExplorer': wrapCommand(revealInExplorer),
|
|
4040
4070
|
'SourceControl.saveState': saveState,
|
|
4041
4071
|
'SourceControl.selectIndex': wrapCommand(selectIndex),
|
|
4042
4072
|
'SourceControl.setDeltaY': wrapCommand(setDeltaY),
|