@lvce-editor/title-bar-worker 4.15.4 → 4.15.5
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/titleBarWorkerMain.js +41 -22
- package/package.json +1 -1
|
@@ -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:
|
|
2371
|
+
flags: RestoreEditorFocus,
|
|
2371
2372
|
id: 'undo',
|
|
2372
2373
|
label: undo()
|
|
2373
2374
|
}, {
|
|
2374
2375
|
command: 'Editor.redo',
|
|
2375
|
-
flags:
|
|
2376
|
+
flags: RestoreEditorFocus,
|
|
2376
2377
|
id: 'redo',
|
|
2377
2378
|
label: redo()
|
|
2378
2379
|
}, menuEntrySeparator, {
|
|
2379
2380
|
command: /* Editor.cut */'Editor.cut',
|
|
2380
|
-
flags:
|
|
2381
|
+
flags: RestoreEditorFocus,
|
|
2381
2382
|
id: 'cut',
|
|
2382
2383
|
label: cut()
|
|
2383
2384
|
}, {
|
|
2384
2385
|
command: /* Editor.copy */'Editor.copy',
|
|
2385
|
-
flags:
|
|
2386
|
+
flags: RestoreEditorFocus,
|
|
2386
2387
|
id: 'copy',
|
|
2387
2388
|
label: copy()
|
|
2388
2389
|
}, {
|
|
2389
2390
|
command: /* Editor.paste */'Editor.paste',
|
|
2390
|
-
flags:
|
|
2391
|
+
flags: RestoreEditorFocus,
|
|
2391
2392
|
id: 'paste',
|
|
2392
2393
|
label: paste()
|
|
2393
2394
|
}, menuEntrySeparator, {
|
|
2394
2395
|
command: /* Editor.toggleLineComment */'Editor.toggleLineComment',
|
|
2395
|
-
flags:
|
|
2396
|
+
flags: RestoreEditorFocus,
|
|
2396
2397
|
id: 'toggle-line-comment',
|
|
2397
2398
|
label: toggleLineComment()
|
|
2398
2399
|
}, {
|
|
2399
2400
|
command: /* Editor.toggleBlockComment */'Editor.toggleBlockComment',
|
|
2400
|
-
flags:
|
|
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:
|
|
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:
|
|
2838
|
+
flags: RestoreEditorFocus,
|
|
2838
2839
|
id: 'selectAll',
|
|
2839
2840
|
label: selectAll()
|
|
2840
2841
|
}, {
|
|
2841
2842
|
command: 'Editor.expandSelection',
|
|
2842
|
-
flags:
|
|
2843
|
+
flags: RestoreEditorFocus,
|
|
2843
2844
|
id: 'expandSelection',
|
|
2844
2845
|
label: expandSelection()
|
|
2845
2846
|
}, {
|
|
2846
2847
|
command: 'Editor.shrinkSelection',
|
|
2847
|
-
flags:
|
|
2848
|
+
flags: RestoreEditorFocus,
|
|
2848
2849
|
id: 'shrinkSelection',
|
|
2849
2850
|
label: shrinkSelection()
|
|
2850
2851
|
}, menuEntrySeparator, {
|
|
2851
2852
|
command: 'Editor.copyLineUp',
|
|
2852
|
-
flags:
|
|
2853
|
+
flags: RestoreEditorFocus,
|
|
2853
2854
|
id: 'copyLineUp',
|
|
2854
2855
|
label: copyLineUp()
|
|
2855
2856
|
}, {
|
|
2856
2857
|
command: 'Editor.copyLineDown',
|
|
2857
|
-
flags:
|
|
2858
|
+
flags: RestoreEditorFocus,
|
|
2858
2859
|
id: 'copyLineDown',
|
|
2859
2860
|
label: copyLineDown()
|
|
2860
2861
|
}, {
|
|
2861
2862
|
command: 'Editor.moveLineUp',
|
|
2862
|
-
flags:
|
|
2863
|
+
flags: RestoreEditorFocus,
|
|
2863
2864
|
id: 'moveLineUp',
|
|
2864
2865
|
label: moveLineUp()
|
|
2865
2866
|
}, {
|
|
2866
2867
|
command: 'Editor.moveLineDown',
|
|
2867
|
-
flags:
|
|
2868
|
+
flags: RestoreEditorFocus,
|
|
2868
2869
|
id: 'moveLineDown',
|
|
2869
2870
|
label: moveLineDown()
|
|
2870
2871
|
}, {
|
|
2871
2872
|
command: 'Editor.duplicateSelection',
|
|
2872
|
-
flags:
|
|
2873
|
+
flags: RestoreEditorFocus,
|
|
2873
2874
|
id: 'duplicateSelection',
|
|
2874
2875
|
label: duplicateSelection()
|
|
2875
2876
|
}, menuEntrySeparator, {
|
|
2876
2877
|
command: 'Editor.addCursorAbove',
|
|
2877
|
-
flags:
|
|
2878
|
+
flags: RestoreEditorFocus,
|
|
2878
2879
|
id: 'addCursorAbove',
|
|
2879
2880
|
label: addCursorAbove()
|
|
2880
2881
|
}, {
|
|
2881
2882
|
command: 'Editor.addCursorBelow',
|
|
2882
|
-
flags:
|
|
2883
|
+
flags: RestoreEditorFocus,
|
|
2883
2884
|
id: 'addCursorBelow',
|
|
2884
2885
|
label: addCursorBelow()
|
|
2885
2886
|
}, {
|
|
2886
2887
|
command: 'Editor.addCursorsToLineEnds',
|
|
2887
|
-
flags:
|
|
2888
|
+
flags: RestoreEditorFocus,
|
|
2888
2889
|
id: 'addCursorsToLineEnds',
|
|
2889
2890
|
label: addCursorsToLineEnds()
|
|
2890
2891
|
}, {
|
|
2891
2892
|
command: 'Editor.addNextOccurrence',
|
|
2892
|
-
flags:
|
|
2893
|
+
flags: RestoreEditorFocus,
|
|
2893
2894
|
id: 'addNextOccurrence',
|
|
2894
2895
|
label: addNextOccurrence()
|
|
2895
2896
|
}, {
|
|
2896
2897
|
command: 'Editor.addPreviousOccurrence',
|
|
2897
|
-
flags:
|
|
2898
|
+
flags: RestoreEditorFocus,
|
|
2898
2899
|
id: 'addPreviousOccurrence',
|
|
2899
2900
|
label: addPreviousOccurrence()
|
|
2900
2901
|
}, {
|
|
2901
2902
|
command: 'Editor.selectAllOccurrences',
|
|
2902
|
-
flags:
|
|
2903
|
+
flags: RestoreEditorFocus,
|
|
2903
2904
|
id: 'selectAllOccurrences',
|
|
2904
2905
|
label: selectAllOccurrences()
|
|
2905
2906
|
}];
|
|
@@ -4263,6 +4264,7 @@ const getMenuItemRenderer = flags => {
|
|
|
4263
4264
|
return getMenuItemDisabledDom;
|
|
4264
4265
|
case Ignore:
|
|
4265
4266
|
case None:
|
|
4267
|
+
case RestoreEditorFocus:
|
|
4266
4268
|
case RestoreFocus:
|
|
4267
4269
|
return getMenuItemDefaultDom;
|
|
4268
4270
|
case Separator$1:
|
|
@@ -5080,6 +5082,21 @@ const selectIndexNone = async (state, item) => {
|
|
|
5080
5082
|
};
|
|
5081
5083
|
};
|
|
5082
5084
|
|
|
5085
|
+
const selectIndexRestoreEditorFocus = async (state, item) => {
|
|
5086
|
+
await executeMenuItemCommand(item);
|
|
5087
|
+
try {
|
|
5088
|
+
await invoke('Main.focus');
|
|
5089
|
+
} catch {
|
|
5090
|
+
// Focus restoration is best effort and must not turn a successful command into a failure.
|
|
5091
|
+
}
|
|
5092
|
+
return {
|
|
5093
|
+
...state,
|
|
5094
|
+
focusedIndex: -1,
|
|
5095
|
+
isMenuOpen: false,
|
|
5096
|
+
menus: []
|
|
5097
|
+
};
|
|
5098
|
+
};
|
|
5099
|
+
|
|
5083
5100
|
const selectIndexRestoreFocus = async (state, item) => {
|
|
5084
5101
|
await executeMenuItemCommand(item);
|
|
5085
5102
|
const latestState = get(state.uid)?.newState ?? state;
|
|
@@ -5141,6 +5158,8 @@ const handleMenuClick = async (state, level, index) => {
|
|
|
5141
5158
|
return selectIndexIgnore(state, item);
|
|
5142
5159
|
case None:
|
|
5143
5160
|
return selectIndexNone(state, item);
|
|
5161
|
+
case RestoreEditorFocus:
|
|
5162
|
+
return selectIndexRestoreEditorFocus(state, item);
|
|
5144
5163
|
case RestoreFocus:
|
|
5145
5164
|
return selectIndexRestoreFocus(state, item);
|
|
5146
5165
|
case SubMenu$1:
|