@lvce-editor/title-bar-worker 4.25.3 → 4.25.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 +36 -4
- package/package.json +1 -1
|
@@ -5354,19 +5354,33 @@ const selectIndexNone = async (state, item) => {
|
|
|
5354
5354
|
const {
|
|
5355
5355
|
uid
|
|
5356
5356
|
} = state;
|
|
5357
|
-
await executeMenuItemCommand(item);
|
|
5358
5357
|
const storedState = get(uid);
|
|
5359
5358
|
const latestState = storedState?.newState ?? state;
|
|
5360
|
-
const
|
|
5359
|
+
const closedState = {
|
|
5361
5360
|
...latestState,
|
|
5362
5361
|
focusedIndex: -1,
|
|
5363
5362
|
isMenuOpen: false,
|
|
5364
5363
|
menus: []
|
|
5365
5364
|
};
|
|
5366
5365
|
if (storedState) {
|
|
5367
|
-
set$1(uid, storedState.oldState,
|
|
5366
|
+
set$1(uid, storedState.oldState, closedState, closedState);
|
|
5367
|
+
if (latestState.menus.length > 0) {
|
|
5368
|
+
const [command, ...args] = renderMenus(latestState, closedState);
|
|
5369
|
+
await invoke$2(command, ...args);
|
|
5370
|
+
}
|
|
5368
5371
|
}
|
|
5369
|
-
|
|
5372
|
+
await executeMenuItemCommand(item);
|
|
5373
|
+
const latestCommandState = get(uid)?.newState ?? closedState;
|
|
5374
|
+
const finalState = {
|
|
5375
|
+
...latestCommandState,
|
|
5376
|
+
focusedIndex: -1,
|
|
5377
|
+
isMenuOpen: false,
|
|
5378
|
+
menus: []
|
|
5379
|
+
};
|
|
5380
|
+
if (storedState) {
|
|
5381
|
+
set$1(uid, finalState, finalState, finalState);
|
|
5382
|
+
}
|
|
5383
|
+
return finalState;
|
|
5370
5384
|
};
|
|
5371
5385
|
|
|
5372
5386
|
const selectIndexRestoreEditorFocus = async (state, item) => {
|
|
@@ -5510,6 +5524,23 @@ const handleKeySpaceMenuOpen = state => handleKeyEnterMenuOpen(state);
|
|
|
5510
5524
|
// TODO this is same as handle key enter -> merge the functions
|
|
5511
5525
|
const handleKeySpace = ifElse(handleKeySpaceMenuOpen, handleKeySpaceMenuClosed);
|
|
5512
5526
|
|
|
5527
|
+
const handleMenuMouseLeave = state => {
|
|
5528
|
+
object(state);
|
|
5529
|
+
const {
|
|
5530
|
+
menus
|
|
5531
|
+
} = state;
|
|
5532
|
+
if (menus.every(menu => menu.focusedIndex === -1)) {
|
|
5533
|
+
return state;
|
|
5534
|
+
}
|
|
5535
|
+
return {
|
|
5536
|
+
...state,
|
|
5537
|
+
menus: menus.map(menu => ({
|
|
5538
|
+
...menu,
|
|
5539
|
+
focusedIndex: -1
|
|
5540
|
+
}))
|
|
5541
|
+
};
|
|
5542
|
+
};
|
|
5543
|
+
|
|
5513
5544
|
const getNewMenus = async (menus, level, index, flags) => {
|
|
5514
5545
|
const menu = menus[level];
|
|
5515
5546
|
if (!menu) {
|
|
@@ -5663,6 +5694,7 @@ const commandMap = {
|
|
|
5663
5694
|
'TitleBar.handleKeyHome': wrapCommand(handleKeyHome),
|
|
5664
5695
|
'TitleBar.handleKeySpace': wrapCommand(handleKeySpace),
|
|
5665
5696
|
'TitleBar.handleMenuClick': wrapCommand(handleMenuClick),
|
|
5697
|
+
'TitleBar.handleMenuMouseLeave': wrapCommand(handleMenuMouseLeave),
|
|
5666
5698
|
'TitleBar.handleMenuMouseOver': wrapCommand(handleMenuMouseOver),
|
|
5667
5699
|
'TitleBar.handleMessagePort': handleDirectMessagePort,
|
|
5668
5700
|
'TitleBar.handleMouseOut': wrapCommand(handleMouseOut),
|