@lvce-editor/source-control-worker 3.12.0 → 3.13.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.
@@ -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
- command: /* TODO */'-1',
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
  };
@@ -3952,6 +3959,17 @@ const renderEventListeners = () => {
3952
3959
  }];
3953
3960
  };
3954
3961
 
3962
+ const revealInExplorer = async (state, uri) => {
3963
+ await invoke$1('SideBar.show', 'Explorer');
3964
+ const states = await invoke$1('Viewlet.getAllStates');
3965
+ const viewlets = Object.values(states);
3966
+ const sideBar = viewlets.find(viewlet => viewlet.currentViewletId === 'Explorer');
3967
+ const explorerUid = Math.max(...viewlets.filter(viewlet => viewlet.parentUid === sideBar.uid).map(viewlet => viewlet.uid));
3968
+ await invoke$1('Viewlet.executeViewletCommand', explorerUid, 'reveal', uri);
3969
+ await invoke$1('Viewlet.executeViewletCommand', explorerUid, 'refresh');
3970
+ return state;
3971
+ };
3972
+
3955
3973
  const saveState = uid => {
3956
3974
  number(uid);
3957
3975
  const value = get(uid);
@@ -4037,6 +4055,7 @@ const commandMap = {
4037
4055
  'SourceControl.renderActions': wrapGetter(renderActions),
4038
4056
  'SourceControl.renderActions2': renderActions,
4039
4057
  'SourceControl.renderEventListeners': renderEventListeners,
4058
+ 'SourceControl.revealInExplorer': wrapCommand(revealInExplorer),
4040
4059
  'SourceControl.saveState': saveState,
4041
4060
  'SourceControl.selectIndex': wrapCommand(selectIndex),
4042
4061
  'SourceControl.setDeltaY': wrapCommand(setDeltaY),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/source-control-worker",
3
- "version": "3.12.0",
3
+ "version": "3.13.0",
4
4
  "description": "Source Control Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"