mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix: CommandPalette doesn't appear from global menu by click/hotkey
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
b1ae284b3b
commit
291595d476
@ -39,7 +39,7 @@ export interface CommandRegistration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class CommandRegistry extends BaseRegistry<CommandRegistration> {
|
export class CommandRegistry extends BaseRegistry<CommandRegistration> {
|
||||||
@observable activeEntity: CatalogEntity;
|
@observable.ref activeEntity: CatalogEntity;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import { EventEmitter } from "../../../common/event-emitter";
|
|||||||
import { subscribeToBroadcast } from "../../../common/ipc";
|
import { subscribeToBroadcast } from "../../../common/ipc";
|
||||||
import { CommandDialog } from "./command-dialog";
|
import { CommandDialog } from "./command-dialog";
|
||||||
import { CommandRegistration, commandRegistry } from "../../../extensions/registries/command-registry";
|
import { CommandRegistration, commandRegistry } from "../../../extensions/registries/command-registry";
|
||||||
|
import type { ClusterId } from "../../../common/cluster-store";
|
||||||
|
|
||||||
export type CommandDialogEvent = {
|
export type CommandDialogEvent = {
|
||||||
component: React.ReactElement
|
component: React.ReactElement
|
||||||
@ -46,11 +47,15 @@ export class CommandOverlay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
export interface CommandContainerProps {
|
||||||
export class CommandContainer extends React.Component<{ clusterId?: string }> {
|
clusterId?: ClusterId;
|
||||||
@observable.ref commandComponent: React.ReactElement;
|
}
|
||||||
|
|
||||||
constructor(props: { clusterId?: string }) {
|
@observer
|
||||||
|
export class CommandContainer extends React.Component<CommandContainerProps> {
|
||||||
|
@observable.ref commandComponent: React.ReactNode = null;
|
||||||
|
|
||||||
|
constructor(props: CommandContainerProps) {
|
||||||
super(props);
|
super(props);
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
}
|
}
|
||||||
@ -88,7 +93,7 @@ export class CommandContainer extends React.Component<{ clusterId?: string }> {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
subscribeToBroadcast("command-palette:open", () => {
|
subscribeToBroadcast("command-palette:open", () => {
|
||||||
CommandOverlay.open(<CommandDialog />);
|
this.commandComponent = <CommandDialog />;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
window.addEventListener("keyup", (e) => this.escHandler(e), true);
|
window.addEventListener("keyup", (e) => this.escHandler(e), true);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user