@lvce-editor/title-bar-worker 4.18.1 → 4.19.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.
@@ -2810,7 +2810,12 @@ const startsWithHomeDir = (homeDir, path) => {
2810
2810
  };
2811
2811
  const getPath = uri => {
2812
2812
  if (uri.startsWith(File)) {
2813
- return uri.slice(File.length);
2813
+ const path = uri.slice(File.length);
2814
+ try {
2815
+ return decodeURIComponent(path);
2816
+ } catch {
2817
+ return path;
2818
+ }
2814
2819
  }
2815
2820
  return uri;
2816
2821
  };
@@ -2840,9 +2845,10 @@ const getTitle$1 = (homeDir, uri) => {
2840
2845
  const toMenuItem = folder => {
2841
2846
  const homeDir = getHomeDir(folder);
2842
2847
  const label = getTitle$1(homeDir, folder);
2848
+ const command = folder.includes('://') ? 'Workspace.setUri' : 'Workspace.setPath';
2843
2849
  return {
2844
2850
  args: [folder],
2845
- command: 'Workspace.setPath',
2851
+ command,
2846
2852
  flags: None,
2847
2853
  label
2848
2854
  };
@@ -3548,7 +3554,7 @@ const set = rpc => {
3548
3554
  state.connected = true;
3549
3555
  };
3550
3556
 
3551
- const handleMessagePort = async (port, viewletCommandMap) => {
3557
+ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
3552
3558
  const executeViewletCommand = async (uid, command, ...args) => {
3553
3559
  const fn = viewletCommandMap[`TitleBar.${command}`];
3554
3560
  if (typeof fn !== 'function') {
@@ -3563,7 +3569,9 @@ const handleMessagePort = async (port, viewletCommandMap) => {
3563
3569
  },
3564
3570
  messagePort: port
3565
3571
  });
3566
- set(rpc);
3572
+ if (setAsRendererProcess) {
3573
+ set(rpc);
3574
+ }
3567
3575
  };
3568
3576
 
3569
3577
  const getMenuOffset = (x, clientX, iconWidth) => {
@@ -3978,7 +3986,7 @@ const getTitle = (workspaceUri, titleTemplate, appName) => {
3978
3986
  return appName;
3979
3987
  }
3980
3988
  const remoteSshWorkspace = getRemoteSshWorkspace(workspaceUri);
3981
- const workspacePath = remoteSshWorkspace?.path ?? workspaceUri;
3989
+ const workspacePath = remoteSshWorkspace?.path ?? getPath(workspaceUri);
3982
3990
  const title = getWorkspaceTitle(workspacePath, titleTemplate, appName);
3983
3991
  if (!remoteSshWorkspace) {
3984
3992
  return title || appName;
@@ -5456,7 +5464,7 @@ const wakeUp = sleepState => {
5456
5464
  set$1(sleepState.uid, sleepState, sleepState);
5457
5465
  };
5458
5466
 
5459
- const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
5467
+ const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
5460
5468
  const commandMap = {
5461
5469
  'TitleBar.closeMenu': wrapCommand(closeMenu),
5462
5470
  'TitleBar.create': create,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "4.18.1",
3
+ "version": "4.19.1",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",