@lvce-editor/title-bar-worker 4.8.1 → 4.9.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.
@@ -598,7 +598,10 @@ const constructError = (message, type, name) => {
598
598
  if (ErrorConstructor === Error) {
599
599
  const error = new Error(message);
600
600
  if (name && name !== 'VError') {
601
- error.name = name;
601
+ Object.defineProperty(error, 'name', {
602
+ configurable: true,
603
+ value: name
604
+ });
602
605
  }
603
606
  return error;
604
607
  }
@@ -629,31 +632,45 @@ const getParentStack = error => {
629
632
  };
630
633
  const MethodNotFound = -32601;
631
634
  const Custom = -32001;
635
+ const setStack = (error, stack) => {
636
+ const descriptor = Object.getOwnPropertyDescriptor(error, 'stack');
637
+ if (descriptor) {
638
+ if (!descriptor.configurable && !descriptor.writable) {
639
+ return;
640
+ }
641
+ if (!descriptor.configurable && descriptor.writable) {
642
+ error.stack = stack;
643
+ return;
644
+ }
645
+ }
646
+ Object.defineProperty(error, 'stack', {
647
+ configurable: true,
648
+ value: stack,
649
+ writable: true
650
+ });
651
+ };
632
652
  const restoreExistingError = (error, currentStack) => {
633
653
  if (typeof error.stack === 'string') {
634
- error.stack = error.stack + NewLine + currentStack;
654
+ setStack(error, `${error.stack}${NewLine}${currentStack}`);
635
655
  }
636
656
  return error;
637
657
  };
638
658
  const restoreMethodNotFoundError = (error, currentStack) => {
639
659
  const restoredError = new JsonRpcError(error.message);
640
660
  const parentStack = getParentStack(error);
641
- restoredError.stack = parentStack + NewLine + currentStack;
661
+ setStack(restoredError, `${parentStack}${NewLine}${currentStack}`);
642
662
  return restoredError;
643
663
  };
644
664
  const restoreStackFromData = (restoredError, error, currentStack) => {
645
665
  if (error.data.stack && error.data.type && error.message) {
646
- restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
666
+ setStack(restoredError, `${error.data.type}: ${error.message}${NewLine}${error.data.stack}${NewLine}${currentStack}`);
647
667
  return;
648
668
  }
649
669
  if (error.data.stack) {
650
- restoredError.stack = error.data.stack;
670
+ setStack(restoredError, error.data.stack);
651
671
  }
652
672
  };
653
673
  const applyDataProperties = (restoredError, error) => {
654
- if (!error.data) {
655
- return;
656
- }
657
674
  restoreStackFromData(restoredError, error, getCurrentStack());
658
675
  if (error.data.codeFrame) {
659
676
  // @ts-ignore
@@ -674,7 +691,7 @@ const applyDirectProperties = (restoredError, error) => {
674
691
  const indexNewLine = getNewLineIndex(lowerStack);
675
692
  const parentStack = getParentStack(error);
676
693
  // @ts-ignore
677
- restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
694
+ setStack(restoredError, `${parentStack}${lowerStack.slice(indexNewLine)}`);
678
695
  }
679
696
  if (error.codeFrame) {
680
697
  // @ts-ignore
@@ -1358,9 +1375,9 @@ const F5$1 = 61;
1358
1375
  const F6$1 = 62;
1359
1376
  const Equal$1 = 84;
1360
1377
  const Comma$1 = 85;
1361
- const Minus$1 = 86;
1362
- const Backquote$1 = 89;
1363
- const Backslash$1 = 91;
1378
+ const Minus$2 = 86;
1379
+ const Backquote$2 = 89;
1380
+ const Backslash$2 = 91;
1364
1381
  const Star$1 = 131;
1365
1382
  const Plus$1 = 132;
1366
1383
 
@@ -1424,15 +1441,15 @@ const F5 = 'F5';
1424
1441
  const F6 = 'F6';
1425
1442
  const Equal = '=';
1426
1443
  const Comma = ',';
1427
- const Minus = 'Minus';
1428
- const Backquote = 'Backquote';
1429
- const Backslash = 'Backslash';
1444
+ const Minus$1 = 'Minus';
1445
+ const Backquote$1 = 'Backquote';
1446
+ const Backslash$1 = 'Backslash';
1430
1447
  const Star = '*';
1431
1448
  const Plus = '+';
1432
1449
 
1433
1450
  const keyCodeStringMap = {
1434
- [Backquote$1]: Backquote,
1435
- [Backslash$1]: Backslash,
1451
+ [Backquote$2]: Backquote$1,
1452
+ [Backslash$2]: Backslash$1,
1436
1453
  [Backspace$1]: Backspace,
1437
1454
  [Comma$1]: Comma,
1438
1455
  [Delete$1]: Delete,
@@ -1486,7 +1503,7 @@ const keyCodeStringMap = {
1486
1503
  [KeyY$1]: KeyY,
1487
1504
  [KeyZ$1]: KeyZ,
1488
1505
  [LeftArrow$1]: LeftArrow,
1489
- [Minus$1]: Minus,
1506
+ [Minus$2]: Minus$1,
1490
1507
  [PageDown$1]: PageDown,
1491
1508
  [PageUp$1]: PageUp,
1492
1509
  [Plus$1]: Plus,
@@ -1897,6 +1914,7 @@ const TitleBar$2 = 'Title Bar';
1897
1914
  const MenuBar = 'Menu Bar';
1898
1915
  const CommandCenter = 'Command Center';
1899
1916
  const CommandPalette = 'Command Palette';
1917
+ const LayoutControls = 'Layout Controls';
1900
1918
  const Edit$1 = 'Edit';
1901
1919
  const EditorLayout = 'Editor Layout';
1902
1920
  const FlipLayout = 'Flip Layout';
@@ -2005,6 +2023,9 @@ const menuBar = () => {
2005
2023
  const commandCenter = () => {
2006
2024
  return i18nString(CommandCenter);
2007
2025
  };
2026
+ const layoutControls = () => {
2027
+ return i18nString(LayoutControls);
2028
+ };
2008
2029
  const copy$1 = () => {
2009
2030
  return i18nString(Copy$1);
2010
2031
  };
@@ -2121,7 +2142,7 @@ const create3 = (id, uri, x, y, width, height, platform, controlsOverlayEnabled,
2121
2142
  };
2122
2143
 
2123
2144
  const isEqual$3 = (oldState, newState) => {
2124
- return oldState.titleBarEntries === newState.titleBarEntries && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen && oldState.title === newState.title && oldState.workspaceUri === newState.workspaceUri;
2145
+ return oldState.titleBarEntries === newState.titleBarEntries && oldState.titleBarMenuBarEnabled === newState.titleBarMenuBarEnabled && oldState.width === newState.width && oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen && oldState.title === newState.title && oldState.workspaceUri === newState.workspaceUri;
2125
2146
  };
2126
2147
 
2127
2148
  const isEqual$2 = (oldState, newState) => {
@@ -2171,16 +2192,19 @@ const Ignore = 7;
2171
2192
  const getMenuEntriesTitleBarContextMenu = async state => {
2172
2193
  const {
2173
2194
  commandCenterEnabled,
2174
- titleBarMenuBarEnabled
2195
+ titleBarMenuBarEnabled,
2196
+ uid
2175
2197
  } = state;
2176
2198
  // TODO checked state should be depending on whether or not that feature is currently visible or not
2177
2199
  return [{
2178
- command: titleBarMenuBarEnabled ? 'TitleBar.hideMenuBar' : 'TitleBar.showMenuBar',
2200
+ args: [uid, titleBarMenuBarEnabled ? 'hideMenuBar' : 'showMenuBar'],
2201
+ command: 'Viewlet.executeViewletCommand',
2179
2202
  flags: titleBarMenuBarEnabled ? Checked : Unchecked,
2180
2203
  id: 'MenuBar',
2181
2204
  label: menuBar()
2182
2205
  }, {
2183
- command: commandCenterEnabled ? 'TitleBar.hideCommandCenter' : 'TitleBar.showCommandCenter',
2206
+ args: [uid, commandCenterEnabled ? 'hideCommandCenter' : 'showCommandCenter'],
2207
+ command: 'Viewlet.executeViewletCommand',
2184
2208
  flags: commandCenterEnabled ? Checked : Unchecked,
2185
2209
  id: 'Command center',
2186
2210
  label: commandCenter()
@@ -2188,7 +2212,7 @@ const getMenuEntriesTitleBarContextMenu = async state => {
2188
2212
  command: '',
2189
2213
  flags: Checked,
2190
2214
  id: 'layout controls',
2191
- label: 'layout controls'
2215
+ label: layoutControls()
2192
2216
  }];
2193
2217
  };
2194
2218
 
@@ -2335,12 +2359,12 @@ const selectAllOccurrences = () => {
2335
2359
 
2336
2360
  const getMenuEntries$d = () => {
2337
2361
  return [{
2338
- command: /* TODO */'-1',
2362
+ command: 'Editor.undo',
2339
2363
  flags: None,
2340
2364
  id: 'undo',
2341
2365
  label: undo()
2342
2366
  }, {
2343
- command: /* TODO */'-1',
2367
+ command: 'Editor.redo',
2344
2368
  flags: None,
2345
2369
  id: 'redo',
2346
2370
  label: redo()
@@ -2374,79 +2398,79 @@ const getMenuEntries$d = () => {
2374
2398
 
2375
2399
  const getMenuEntries$c = () => {
2376
2400
  return [{
2377
- command: 'MainArea.splitUp',
2401
+ command: 'Main.splitUp',
2378
2402
  flags: None,
2379
2403
  id: 'splitUp',
2380
2404
  keyboardShortCut: 'Ctrl+K Ctrl+\\',
2381
2405
  label: i18nString(SplitUp)
2382
2406
  }, {
2383
- command: 'MainArea.splitDown',
2407
+ command: 'Main.splitDown',
2384
2408
  flags: None,
2385
2409
  id: 'splitDown',
2386
2410
  label: i18nString(SplitDown)
2387
2411
  }, {
2388
- command: 'MainArea.splitLeft',
2412
+ command: 'Main.splitLeft',
2389
2413
  flags: None,
2390
2414
  id: 'splitLeft',
2391
2415
  label: i18nString(SplitLeft)
2392
2416
  }, {
2393
- command: 'MainArea.splitRight',
2417
+ command: 'Main.splitRight',
2394
2418
  flags: None,
2395
2419
  id: 'splitRight',
2396
2420
  label: i18nString(SplitRight)
2397
2421
  }, menuEntrySeparator, {
2398
- command: 'MainArea.moveIntoNewWindow',
2422
+ command: 'Main.moveIntoNewWindow',
2399
2423
  flags: None,
2400
2424
  id: 'moveEditorIntoNewWindow',
2401
2425
  label: i18nString(MoveEditorIntoNewWindow)
2402
2426
  }, {
2403
- command: 'MainArea.copyIntoNewWindow',
2427
+ command: 'Main.copyIntoNewWindow',
2404
2428
  flags: None,
2405
2429
  id: 'copyEditorIntoNewWindow',
2406
2430
  keyboardShortCut: 'Ctrl+K O',
2407
2431
  label: i18nString(CopyEditorIntoNewWindow)
2408
2432
  }, menuEntrySeparator, {
2409
- command: 'MainArea.setEditorLayoutSingle',
2433
+ command: 'Main.setEditorLayoutSingle',
2410
2434
  flags: None,
2411
2435
  id: 'single',
2412
2436
  label: i18nString(Single)
2413
2437
  }, {
2414
- command: 'MainArea.setEditorLayoutTwoColumns',
2438
+ command: 'Main.setEditorLayoutTwoColumns',
2415
2439
  flags: None,
2416
2440
  id: 'twoColumns',
2417
2441
  label: i18nString(TwoColumns)
2418
2442
  }, {
2419
- command: 'MainArea.setEditorLayoutThreeColumns',
2443
+ command: 'Main.setEditorLayoutThreeColumns',
2420
2444
  flags: None,
2421
2445
  id: 'threeColumns',
2422
2446
  label: i18nString(ThreeColumns)
2423
2447
  }, {
2424
- command: 'MainArea.setEditorLayoutTwoRows',
2448
+ command: 'Main.setEditorLayoutTwoRows',
2425
2449
  flags: None,
2426
2450
  id: 'twoRows',
2427
2451
  label: i18nString(TwoRows)
2428
2452
  }, {
2429
- command: 'MainArea.setEditorLayoutThreeRows',
2453
+ command: 'Main.setEditorLayoutThreeRows',
2430
2454
  flags: None,
2431
2455
  id: 'threeRows',
2432
2456
  label: i18nString(ThreeRows)
2433
2457
  }, {
2434
- command: 'MainArea.setEditorLayoutGrid',
2458
+ command: 'Main.setEditorLayoutGrid',
2435
2459
  flags: None,
2436
2460
  id: 'gridTwoByTwo',
2437
2461
  label: i18nString(GridTwoByTwo)
2438
2462
  }, {
2439
- command: 'MainArea.setEditorLayoutTwoRowsRight',
2463
+ command: 'Main.setEditorLayoutTwoRowsRight',
2440
2464
  flags: None,
2441
2465
  id: 'twoRowsRight',
2442
2466
  label: i18nString(TwoRowsRight)
2443
2467
  }, {
2444
- command: 'MainArea.setEditorLayoutTwoColumnsBottom',
2468
+ command: 'Main.setEditorLayoutTwoColumnsBottom',
2445
2469
  flags: None,
2446
2470
  id: 'twoColumnsBottom',
2447
2471
  label: i18nString(TwoColumnsBottom)
2448
2472
  }, menuEntrySeparator, {
2449
- command: 'MainArea.flipEditorLayout',
2473
+ command: 'Main.flipEditorLayout',
2450
2474
  flags: None,
2451
2475
  id: 'flipLayout',
2452
2476
  keyboardShortCut: 'Shift+Alt+8',
@@ -3483,6 +3507,34 @@ const getTitleBarIndexFromPosition = (titleBarEntries, x, y) => {
3483
3507
  return -1;
3484
3508
  };
3485
3509
 
3510
+ const toCommandInfo = entry => {
3511
+ return {
3512
+ args: entry.args,
3513
+ command: entry.command
3514
+ };
3515
+ };
3516
+ const addMenuEntryKeyBindings = async entries => {
3517
+ try {
3518
+ const commands = entries.map(toCommandInfo);
3519
+ const keys = await invoke('Layout.getKeyBindings', commands);
3520
+ if (!keys.some(Boolean)) {
3521
+ return entries;
3522
+ }
3523
+ return entries.map((entry, index) => {
3524
+ const key = keys[index];
3525
+ if (!key) {
3526
+ return entry;
3527
+ }
3528
+ return {
3529
+ ...entry,
3530
+ key
3531
+ };
3532
+ });
3533
+ } catch {
3534
+ return entries;
3535
+ }
3536
+ };
3537
+
3486
3538
  const getTotalWidth = entries => {
3487
3539
  let total = 0;
3488
3540
  for (const entry of entries) {
@@ -3594,10 +3646,11 @@ const openMenuAtIndex = async (state, index, shouldBeFocused) => {
3594
3646
  const {
3595
3647
  id
3596
3648
  } = titleBarEntry;
3597
- const items = id === OverflowMenuId ? getOverflowMenuItems(titleBarEntry.hiddenEntries || []) : await getMenuEntries2(state, {
3649
+ const rawItems = id === OverflowMenuId ? getOverflowMenuItems(titleBarEntry.hiddenEntries || []) : await getMenuEntries2(state, {
3598
3650
  menuId: id,
3599
3651
  platform
3600
3652
  });
3653
+ const items = id === OverflowMenuId ? rawItems : await addMenuEntryKeyBindings(rawItems);
3601
3654
  const relevantEntries = titleBarEntries.slice(0, index);
3602
3655
  const totalWidths = getTotalWidth(relevantEntries);
3603
3656
  const offset = totalWidths;
@@ -3935,42 +3988,53 @@ const TitleBarTopLevelEntry = 'TitleBarTopLevelEntry';
3935
3988
  const TitleBarTopLevelEntryLabel = 'TitleBarTopLevelEntryLabel';
3936
3989
  const Viewlet = 'Viewlet';
3937
3990
 
3938
- const checkMark = {
3939
- className: mergeClassNames(MenuItemCheckmarkIcon, MaskIconCheck),
3940
- type: Div
3941
- };
3942
- const getMenuItemCheckedDom = menuItem => {
3943
- const {
3944
- isFocused,
3945
- label
3946
- } = menuItem;
3947
- const baseClassName = mergeClassNames(MenuItem, MenuItemCheckMark);
3948
- const className = isFocused ? mergeClassNames(baseClassName, MenuItemFocused) : baseClassName;
3949
- return [{
3950
- ariaChecked: true,
3951
- childCount: 2,
3952
- className,
3953
- role: MenuItemCheckBox,
3954
- tabIndex: -1,
3955
- type: Div
3956
- }, checkMark, text(label)];
3957
- };
3958
-
3959
3991
  const getKeyBindingString = (key, altKey, ctrlKey, shiftKey, metaKey) => {
3960
3992
  let string = '';
3961
3993
  if (ctrlKey) {
3962
3994
  string += 'Ctrl+';
3963
3995
  }
3996
+ if (altKey) {
3997
+ string += 'Alt+';
3998
+ }
3964
3999
  if (shiftKey) {
3965
4000
  string += 'Shift+';
3966
4001
  }
3967
- string += key.toUpperCase();
4002
+ string += key.length === 1 ? key.toUpperCase() : key;
3968
4003
  return string;
3969
4004
  };
3970
4005
 
4006
+ const F11 = 67;
4007
+ const Minus = 86;
4008
+ const Slash = 88;
4009
+ const Backquote = 89;
4010
+ const Backslash = 91;
4011
+ const Numpad0 = 96;
4012
+
4013
+ const getKeyLabel = (keyCode, fallback) => {
4014
+ switch (keyCode) {
4015
+ case Backquote:
4016
+ return '`';
4017
+ case Backslash:
4018
+ return '\\';
4019
+ case F11:
4020
+ return 'F11';
4021
+ case Minus:
4022
+ return '-';
4023
+ case Numpad0:
4024
+ return 'NumPad0';
4025
+ case Slash:
4026
+ return '/';
4027
+ default:
4028
+ return fallback;
4029
+ }
4030
+ };
4031
+
4032
+ const altKeyMask = 1 << 9;
3971
4033
  const getKeyDom = key => {
3972
4034
  const parsedKey = parseKey(key);
3973
- const keyBindingsString = getKeyBindingString(parsedKey.key, false, parsedKey.isCtrl, parsedKey.isShift);
4035
+ const isAlt = Boolean(key & altKeyMask);
4036
+ const keyLabel = getKeyLabel(key & 0xff, parsedKey.key);
4037
+ const keyBindingsString = getKeyBindingString(keyLabel, isAlt, parsedKey.isCtrl, parsedKey.isShift);
3974
4038
  return [{
3975
4039
  childCount: 1,
3976
4040
  className: MenuItemKeyBinding,
@@ -3978,6 +4042,29 @@ const getKeyDom = key => {
3978
4042
  }, text(keyBindingsString)];
3979
4043
  };
3980
4044
 
4045
+ const checkMark = {
4046
+ className: mergeClassNames(MenuItemCheckmarkIcon, MaskIconCheck),
4047
+ type: Div
4048
+ };
4049
+ const getMenuItemCheckedDom = menuItem => {
4050
+ const {
4051
+ isFocused,
4052
+ key,
4053
+ label
4054
+ } = menuItem;
4055
+ const baseClassName = mergeClassNames(MenuItem, MenuItemCheckMark);
4056
+ const className = isFocused ? mergeClassNames(baseClassName, MenuItemFocused) : baseClassName;
4057
+ const keyDom = key ? getKeyDom(key) : [];
4058
+ return [{
4059
+ ariaChecked: true,
4060
+ childCount: key ? 3 : 2,
4061
+ className,
4062
+ role: MenuItemCheckBox,
4063
+ tabIndex: -1,
4064
+ type: Div
4065
+ }, checkMark, text(label), ...keyDom];
4066
+ };
4067
+
3981
4068
  const classNameFocused = mergeClassNames(MenuItem, MenuItemFocused);
3982
4069
  const getMenuItemClassName = isFocused => {
3983
4070
  if (isFocused) {
@@ -4003,19 +4090,20 @@ const getMenuItemDefaultDom = menuItem => {
4003
4090
  }, text(label), ...keyDom];
4004
4091
  };
4005
4092
 
4006
- const disabled = {
4007
- childCount: 1,
4008
- className: MenuItem,
4009
- disabled: true,
4010
- role: MenuItem$1,
4011
- tabIndex: -1,
4012
- type: Div
4013
- };
4014
4093
  const getMenuItemDisabledDom = menuItem => {
4015
4094
  const {
4095
+ key,
4016
4096
  label
4017
4097
  } = menuItem;
4018
- return [disabled, text(label)];
4098
+ const keyDom = key ? getKeyDom(key) : [];
4099
+ return [{
4100
+ childCount: key ? 2 : 1,
4101
+ className: MenuItem,
4102
+ disabled: true,
4103
+ role: MenuItem$1,
4104
+ tabIndex: -1,
4105
+ type: Div
4106
+ }, text(label), ...keyDom];
4019
4107
  };
4020
4108
 
4021
4109
  const getMenuItemsNoopDom = () => {
@@ -4066,17 +4154,19 @@ const getMenuItemSubMenuDom = menuItem => {
4066
4154
  const getMenuItemUncheckedDom = menuItem => {
4067
4155
  const {
4068
4156
  isFocused,
4157
+ key,
4069
4158
  label
4070
4159
  } = menuItem;
4071
4160
  const className = isFocused ? mergeClassNames(MenuItem, MenuItemFocused) : MenuItem;
4161
+ const keyDom = key ? getKeyDom(key) : [];
4072
4162
  return [{
4073
4163
  ariaChecked: false,
4074
- childCount: 1,
4164
+ childCount: key ? 2 : 1,
4075
4165
  className,
4076
4166
  role: MenuItemCheckBox,
4077
4167
  tabIndex: -1,
4078
4168
  type: Div
4079
- }, text(label)];
4169
+ }, text(label), ...keyDom];
4080
4170
  };
4081
4171
 
4082
4172
  const getMenuItemRenderer = flags => {
@@ -4282,6 +4372,7 @@ const getTitleBarMenuBarVirtualDom = (menuBarEnabled, visibleItems, focusedIndex
4282
4372
  ariaActivedescendant: focusedIndex === -1 ? '' : activeId,
4283
4373
  childCount: visibleItems.length,
4284
4374
  className: mergeClassNames(Viewlet, TitleBarMenuBar),
4375
+ onContextMenu: HandleContextMenu,
4285
4376
  onFocusIn: HandleFocusIn,
4286
4377
  onFocusOut: HandleFocusOut,
4287
4378
  onMouseDown: HandleClick,
@@ -4329,9 +4420,10 @@ const getTitleBarVirtualDom = state => {
4329
4420
  }
4330
4421
  const iconSrc = getIcon(assetDir);
4331
4422
  const visibleEntries = getVisibleTitleBarEntries(titleBarEntries, width, focusedIndex, isMenuOpen);
4423
+ const childCount = Number(titleBarIconEnabled) + Number(titleBarMenuBarEnabled) + Number(titleBarTitleEnabled) + Number(titleBarButtonsEnabled);
4332
4424
  return [{
4333
4425
  ariaLabel: titleBar(),
4334
- childCount: 4,
4426
+ childCount,
4335
4427
  className: mergeClassNames(Viewlet, TitleBar),
4336
4428
  id: 'TitleBar',
4337
4429
  onContextMenu: HandleTitleBarContextMenu,
@@ -4383,7 +4475,8 @@ const renderEventListeners = () => {
4383
4475
  params: ['handleClickMinimize']
4384
4476
  }, {
4385
4477
  name: HandleContextMenu,
4386
- params: ['handleContextMenu', Button, ClientX, ClientY]
4478
+ params: ['handleContextMenu', Button, ClientX, ClientY],
4479
+ preventDefault: true
4387
4480
  }, {
4388
4481
  name: HandleTitleBarContextMenu,
4389
4482
  params: ['handleTitleBarContextMenu'],
@@ -4768,7 +4861,8 @@ const handleKeyArrowRightMenuOpen = async state => {
4768
4861
  }
4769
4862
  const item = items[focusedIndex];
4770
4863
  if (item.flags === SubMenu$1 && item.id !== undefined) {
4771
- const subMenuEntries = await getMenuEntries(item.id);
4864
+ const rawSubMenuEntries = await getMenuEntries(item.id);
4865
+ const subMenuEntries = await addMenuEntryKeyBindings(rawSubMenuEntries);
4772
4866
  const subMenu = {
4773
4867
  focusedIndex: 0,
4774
4868
  items: subMenuEntries,
@@ -4933,7 +5027,8 @@ const selectIndexSubMenu = async (state, menu, index) => {
4933
5027
  if (!item.id) {
4934
5028
  return state;
4935
5029
  }
4936
- const subMenuEntries = await getMenuEntries(item.id);
5030
+ const rawSubMenuEntries = await getMenuEntries(item.id);
5031
+ const subMenuEntries = await addMenuEntryKeyBindings(rawSubMenuEntries);
4937
5032
  const subMenu = {
4938
5033
  focusedIndex: -1,
4939
5034
  items: subMenuEntries,
@@ -5020,7 +5115,8 @@ const getNewMenus = async (menus, level, index, flags) => {
5020
5115
  if (!item.id) {
5021
5116
  return menus;
5022
5117
  }
5023
- const subMenuEntries = await getMenuEntries(item.id);
5118
+ const rawSubMenuEntries = await getMenuEntries(item.id);
5119
+ const subMenuEntries = await addMenuEntryKeyBindings(rawSubMenuEntries);
5024
5120
  const subMenu = {
5025
5121
  focusedIndex: -1,
5026
5122
  items: subMenuEntries,
@@ -5094,7 +5190,7 @@ const commandMap = {
5094
5190
  'TitleBar.getCommandIds': getCommandIds,
5095
5191
  'TitleBar.getCommands': getCommandIds,
5096
5192
  'TitleBar.getKeyBindings': getKeyBindings,
5097
- 'TitleBar.getMenuEntries2': getMenuEntries2,
5193
+ 'TitleBar.getMenuEntries2': wrapGetter(getMenuEntries2),
5098
5194
  'TitleBar.getMenuIds': getMenuIds,
5099
5195
  'TitleBar.handleButtonsClick': handleClick$1,
5100
5196
  'TitleBar.handleClick': wrapCommand(handleClick),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "4.8.1",
3
+ "version": "4.9.1",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",