@lvce-editor/menu-worker 4.2.0 → 4.4.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.
- package/dist/menuWorkerMain.js +27 -5
- package/package.json +1 -1
package/dist/menuWorkerMain.js
CHANGED
|
@@ -1875,12 +1875,12 @@ const getMenuEntries$c = platform => {
|
|
|
1875
1875
|
label: openRecent()
|
|
1876
1876
|
}, menuEntrySeparator, {
|
|
1877
1877
|
command: 'Main.save',
|
|
1878
|
-
flags:
|
|
1878
|
+
flags: Disabled,
|
|
1879
1879
|
id: 'save',
|
|
1880
1880
|
label: save()
|
|
1881
1881
|
}, {
|
|
1882
1882
|
command: 'Main.saveAll',
|
|
1883
|
-
flags:
|
|
1883
|
+
flags: Disabled,
|
|
1884
1884
|
id: 'saveAll',
|
|
1885
1885
|
label: saveAll()
|
|
1886
1886
|
}];
|
|
@@ -2273,6 +2273,7 @@ const Menu = 'Menu';
|
|
|
2273
2273
|
const MenuItem = 'MenuItem';
|
|
2274
2274
|
const MenuItemCheckMark = 'MenuItemCheckMark';
|
|
2275
2275
|
const MenuItemCheckmarkIcon = 'MenuItemCheckmarkIcon';
|
|
2276
|
+
const MenuItemDisabled = 'MenuItemDisabled';
|
|
2276
2277
|
const MenuItemFocused = 'MenuItemFocused';
|
|
2277
2278
|
const MenuItemKeyBinding = 'MenuItemKeyBinding';
|
|
2278
2279
|
const MenuItemSeparator = 'MenuItemSeparator';
|
|
@@ -2357,8 +2358,9 @@ const getMenuItemDefaultDom = menuItem => {
|
|
|
2357
2358
|
};
|
|
2358
2359
|
|
|
2359
2360
|
const disabled = {
|
|
2361
|
+
ariaDisabled: true,
|
|
2360
2362
|
childCount: 1,
|
|
2361
|
-
className: MenuItem
|
|
2363
|
+
className: `${MenuItem} ${MenuItemDisabled}`,
|
|
2362
2364
|
disabled: true,
|
|
2363
2365
|
role: MenuItem$1,
|
|
2364
2366
|
tabIndex: -1,
|
|
@@ -2562,6 +2564,7 @@ const show$2 = async (x, y, id, mouseBlocking = false, ...args) => {
|
|
|
2562
2564
|
const items = await getMenuEntriesWithKeyBindings(id, ...args);
|
|
2563
2565
|
const bounds = await getMenuBounds(x, y, items);
|
|
2564
2566
|
const menu = addMenuInternal({
|
|
2567
|
+
args,
|
|
2565
2568
|
focusedIndex: -1,
|
|
2566
2569
|
id,
|
|
2567
2570
|
items,
|
|
@@ -2577,10 +2580,12 @@ const show2$2 = async (uid, menuId, x, y, mouseBlocking = false, ...args) => {
|
|
|
2577
2580
|
const items = await getMenuEntriesWithKeyBindings2(uid, menuId, ...args);
|
|
2578
2581
|
const bounds = await getMenuBounds(x, y, items);
|
|
2579
2582
|
const menu = addMenuInternal({
|
|
2583
|
+
args,
|
|
2580
2584
|
focusedIndex: -1,
|
|
2581
2585
|
id: menuId,
|
|
2582
2586
|
items,
|
|
2583
2587
|
level: getCount(),
|
|
2588
|
+
uid,
|
|
2584
2589
|
x: bounds.x,
|
|
2585
2590
|
y: bounds.y
|
|
2586
2591
|
});
|
|
@@ -2906,20 +2911,37 @@ const resolveAfterTimeout = async () => {
|
|
|
2906
2911
|
await promise;
|
|
2907
2912
|
};
|
|
2908
2913
|
|
|
2914
|
+
const getSubMenuItems = async (parentMenu, item) => {
|
|
2915
|
+
const args = item.args || parentMenu.args || [];
|
|
2916
|
+
if (typeof parentMenu.uid === 'number') {
|
|
2917
|
+
return getMenuEntries2(parentMenu.uid, item.id, ...args);
|
|
2918
|
+
}
|
|
2919
|
+
return getMenuEntries$1(item.id, ...args);
|
|
2920
|
+
};
|
|
2921
|
+
const getOpenSubMenuToLeft = parentMenu => {
|
|
2922
|
+
return parentMenu.openSubMenuToLeft === true || parentMenu.args?.[0]?.openSubMenuToLeft === true;
|
|
2923
|
+
};
|
|
2924
|
+
const getSubMenuX = (parentMenu, openSubMenuToLeft) => {
|
|
2925
|
+
return openSubMenuToLeft ? parentMenu.x - MENU_WIDTH : parentMenu.x + MENU_WIDTH;
|
|
2926
|
+
};
|
|
2909
2927
|
const showSubMenuAtEnter = async (level, index, enterX, enterY) => {
|
|
2910
2928
|
// TODO delete old menus
|
|
2911
2929
|
set$1(getAll().slice(0, level + 1));
|
|
2912
2930
|
const parentMenu = get$1(level);
|
|
2913
2931
|
const item = parentMenu.items[index];
|
|
2914
|
-
const subMenuItems = await
|
|
2932
|
+
const subMenuItems = await getSubMenuItems(parentMenu, item);
|
|
2933
|
+
const openSubMenuToLeft = getOpenSubMenuToLeft(parentMenu);
|
|
2915
2934
|
const subMenu = addMenuInternal({
|
|
2935
|
+
args: item.args || parentMenu.args || [],
|
|
2916
2936
|
enterX,
|
|
2917
2937
|
enterY,
|
|
2918
2938
|
focusedIndex: -1,
|
|
2919
2939
|
id: item.id,
|
|
2920
2940
|
items: subMenuItems,
|
|
2921
2941
|
level: getCount(),
|
|
2922
|
-
|
|
2942
|
+
openSubMenuToLeft,
|
|
2943
|
+
uid: parentMenu.uid,
|
|
2944
|
+
x: getSubMenuX(parentMenu, openSubMenuToLeft),
|
|
2923
2945
|
y: parentMenu.y + index * 25
|
|
2924
2946
|
});
|
|
2925
2947
|
const width = getMenuWidth();
|