mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
import { getInjectable } from "@ogre-tools/injectable";
|
|
import applicationMenuItemInjectionToken from "../../application-menu-item-injection-token";
|
|
import broadcastMessageInjectable from "../../../../../../common/ipc/broadcast-message.injectable";
|
|
|
|
const openCommandPaletteMenuItemInjectable = getInjectable({
|
|
id: "open-command-palette-menu-item",
|
|
|
|
instantiate: (di) => {
|
|
const broadcastMessage = di.inject(broadcastMessageInjectable);
|
|
|
|
return {
|
|
parentId: "view",
|
|
id: "open-command-palette",
|
|
orderNumber: 20,
|
|
label: "Command Palette...",
|
|
accelerator: "Shift+CmdOrCtrl+P",
|
|
|
|
click(_m, _b, event) {
|
|
/**
|
|
* Don't broadcast unless it was triggered by menu iteration so that
|
|
* there aren't double events in renderer
|
|
*
|
|
* NOTE: this `?` is required because of a bug in playwright. https://github.com/microsoft/playwright/issues/10554
|
|
*/
|
|
if (!event?.triggeredByAccelerator) {
|
|
broadcastMessage("command-palette:open");
|
|
}
|
|
},
|
|
};
|
|
},
|
|
|
|
injectionToken: applicationMenuItemInjectionToken,
|
|
});
|
|
|
|
export default openCommandPaletteMenuItemInjectable;
|