@lvce-editor/title-bar-worker 4.15.4 → 4.15.6

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.
@@ -2195,6 +2195,7 @@ const Unchecked = 3;
2195
2195
  const Disabled = 5;
2196
2196
  const RestoreFocus = 6;
2197
2197
  const Ignore = 7;
2198
+ const RestoreEditorFocus = 8;
2198
2199
 
2199
2200
  const getMenuEntriesTitleBarContextMenu = async state => {
2200
2201
  const {
@@ -2367,37 +2368,37 @@ const selectAllOccurrences = () => {
2367
2368
  const getMenuEntries$d = () => {
2368
2369
  return [{
2369
2370
  command: 'Editor.undo',
2370
- flags: None,
2371
+ flags: RestoreEditorFocus,
2371
2372
  id: 'undo',
2372
2373
  label: undo()
2373
2374
  }, {
2374
2375
  command: 'Editor.redo',
2375
- flags: None,
2376
+ flags: RestoreEditorFocus,
2376
2377
  id: 'redo',
2377
2378
  label: redo()
2378
2379
  }, menuEntrySeparator, {
2379
2380
  command: /* Editor.cut */'Editor.cut',
2380
- flags: None,
2381
+ flags: RestoreEditorFocus,
2381
2382
  id: 'cut',
2382
2383
  label: cut()
2383
2384
  }, {
2384
2385
  command: /* Editor.copy */'Editor.copy',
2385
- flags: None,
2386
+ flags: RestoreEditorFocus,
2386
2387
  id: 'copy',
2387
2388
  label: copy()
2388
2389
  }, {
2389
2390
  command: /* Editor.paste */'Editor.paste',
2390
- flags: None,
2391
+ flags: RestoreEditorFocus,
2391
2392
  id: 'paste',
2392
2393
  label: paste()
2393
2394
  }, menuEntrySeparator, {
2394
2395
  command: /* Editor.toggleLineComment */'Editor.toggleLineComment',
2395
- flags: None,
2396
+ flags: RestoreEditorFocus,
2396
2397
  id: 'toggle-line-comment',
2397
2398
  label: toggleLineComment()
2398
2399
  }, {
2399
2400
  command: /* Editor.toggleBlockComment */'Editor.toggleBlockComment',
2400
- flags: None,
2401
+ flags: RestoreEditorFocus,
2401
2402
  id: 'toggle-block-comment',
2402
2403
  label: toggleBlockComment()
2403
2404
  }];
@@ -2706,7 +2707,7 @@ const getMenuEntries$9 = async platform => {
2706
2707
  }
2707
2708
  entries.push({
2708
2709
  command: 'License.openLicense',
2709
- flags: None,
2710
+ flags: RestoreEditorFocus,
2710
2711
  id: 'viewLicense',
2711
2712
  label: viewLicense()
2712
2713
  });
@@ -2834,72 +2835,72 @@ const getMenuEntries$7 = () => {
2834
2835
  const getMenuEntries$6 = () => {
2835
2836
  return [{
2836
2837
  command: 'Editor.selectAll',
2837
- flags: None,
2838
+ flags: RestoreEditorFocus,
2838
2839
  id: 'selectAll',
2839
2840
  label: selectAll()
2840
2841
  }, {
2841
2842
  command: 'Editor.expandSelection',
2842
- flags: None,
2843
+ flags: RestoreEditorFocus,
2843
2844
  id: 'expandSelection',
2844
2845
  label: expandSelection()
2845
2846
  }, {
2846
2847
  command: 'Editor.shrinkSelection',
2847
- flags: None,
2848
+ flags: RestoreEditorFocus,
2848
2849
  id: 'shrinkSelection',
2849
2850
  label: shrinkSelection()
2850
2851
  }, menuEntrySeparator, {
2851
2852
  command: 'Editor.copyLineUp',
2852
- flags: None,
2853
+ flags: RestoreEditorFocus,
2853
2854
  id: 'copyLineUp',
2854
2855
  label: copyLineUp()
2855
2856
  }, {
2856
2857
  command: 'Editor.copyLineDown',
2857
- flags: None,
2858
+ flags: RestoreEditorFocus,
2858
2859
  id: 'copyLineDown',
2859
2860
  label: copyLineDown()
2860
2861
  }, {
2861
2862
  command: 'Editor.moveLineUp',
2862
- flags: None,
2863
+ flags: RestoreEditorFocus,
2863
2864
  id: 'moveLineUp',
2864
2865
  label: moveLineUp()
2865
2866
  }, {
2866
2867
  command: 'Editor.moveLineDown',
2867
- flags: None,
2868
+ flags: RestoreEditorFocus,
2868
2869
  id: 'moveLineDown',
2869
2870
  label: moveLineDown()
2870
2871
  }, {
2871
2872
  command: 'Editor.duplicateSelection',
2872
- flags: None,
2873
+ flags: RestoreEditorFocus,
2873
2874
  id: 'duplicateSelection',
2874
2875
  label: duplicateSelection()
2875
2876
  }, menuEntrySeparator, {
2876
2877
  command: 'Editor.addCursorAbove',
2877
- flags: None,
2878
+ flags: RestoreEditorFocus,
2878
2879
  id: 'addCursorAbove',
2879
2880
  label: addCursorAbove()
2880
2881
  }, {
2881
2882
  command: 'Editor.addCursorBelow',
2882
- flags: None,
2883
+ flags: RestoreEditorFocus,
2883
2884
  id: 'addCursorBelow',
2884
2885
  label: addCursorBelow()
2885
2886
  }, {
2886
2887
  command: 'Editor.addCursorsToLineEnds',
2887
- flags: None,
2888
+ flags: RestoreEditorFocus,
2888
2889
  id: 'addCursorsToLineEnds',
2889
2890
  label: addCursorsToLineEnds()
2890
2891
  }, {
2891
2892
  command: 'Editor.addNextOccurrence',
2892
- flags: None,
2893
+ flags: RestoreEditorFocus,
2893
2894
  id: 'addNextOccurrence',
2894
2895
  label: addNextOccurrence()
2895
2896
  }, {
2896
2897
  command: 'Editor.addPreviousOccurrence',
2897
- flags: None,
2898
+ flags: RestoreEditorFocus,
2898
2899
  id: 'addPreviousOccurrence',
2899
2900
  label: addPreviousOccurrence()
2900
2901
  }, {
2901
2902
  command: 'Editor.selectAllOccurrences',
2902
- flags: None,
2903
+ flags: RestoreEditorFocus,
2903
2904
  id: 'selectAllOccurrences',
2904
2905
  label: selectAllOccurrences()
2905
2906
  }];
@@ -3043,24 +3044,25 @@ const getMenuEntries$1 = () => {
3043
3044
  id: 'search',
3044
3045
  label: i18nString(Search)
3045
3046
  }, {
3046
- args: ['Source Control'],
3047
+ args: ['Source Control', true],
3047
3048
  command: 'Layout.openSideBarViewlet',
3048
3049
  flags: None,
3049
3050
  id: 'sourceControl',
3050
3051
  label: i18nString(SourceControl)
3051
3052
  }, {
3052
- args: ['Run And Debug'],
3053
+ args: ['Run And Debug', true],
3053
3054
  command: 'Layout.openSideBarViewlet',
3054
3055
  flags: None,
3055
3056
  id: 'run',
3056
3057
  label: i18nString(Run$1)
3057
3058
  }, {
3058
- args: ['Extensions'],
3059
+ args: ['Extensions', true],
3059
3060
  command: 'Layout.openSideBarViewlet',
3060
3061
  flags: None,
3061
3062
  id: 'extensions',
3062
3063
  label: i18nString(Extensions)
3063
3064
  }, menuEntrySeparator, {
3065
+ args: [true],
3064
3066
  command: 'Layout.openChat',
3065
3067
  flags: None,
3066
3068
  id: 'chat',
@@ -4263,6 +4265,7 @@ const getMenuItemRenderer = flags => {
4263
4265
  return getMenuItemDisabledDom;
4264
4266
  case Ignore:
4265
4267
  case None:
4268
+ case RestoreEditorFocus:
4266
4269
  case RestoreFocus:
4267
4270
  return getMenuItemDefaultDom;
4268
4271
  case Separator$1:
@@ -5080,6 +5083,21 @@ const selectIndexNone = async (state, item) => {
5080
5083
  };
5081
5084
  };
5082
5085
 
5086
+ const selectIndexRestoreEditorFocus = async (state, item) => {
5087
+ await executeMenuItemCommand(item);
5088
+ try {
5089
+ await invoke('Main.focus');
5090
+ } catch {
5091
+ // Focus restoration is best effort and must not turn a successful command into a failure.
5092
+ }
5093
+ return {
5094
+ ...state,
5095
+ focusedIndex: -1,
5096
+ isMenuOpen: false,
5097
+ menus: []
5098
+ };
5099
+ };
5100
+
5083
5101
  const selectIndexRestoreFocus = async (state, item) => {
5084
5102
  await executeMenuItemCommand(item);
5085
5103
  const latestState = get(state.uid)?.newState ?? state;
@@ -5141,6 +5159,8 @@ const handleMenuClick = async (state, level, index) => {
5141
5159
  return selectIndexIgnore(state, item);
5142
5160
  case None:
5143
5161
  return selectIndexNone(state, item);
5162
+ case RestoreEditorFocus:
5163
+ return selectIndexRestoreEditorFocus(state, item);
5144
5164
  case RestoreFocus:
5145
5165
  return selectIndexRestoreFocus(state, item);
5146
5166
  case SubMenu$1:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "4.15.4",
3
+ "version": "4.15.6",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",