Skip to content

Commit

Permalink
feat: add hotkey in workspace plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
liujuping committed Jul 14, 2023
1 parent 2d98f1c commit d21b2dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/editor-core/src/hotkey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ function getKeyInfo(combination: string, action?: string): KeyInfo {
function fireCallback(callback: IPublicTypeHotkeyCallback, e: KeyboardEvent, combo?: string, sequence?: string): void {
try {
const workspace = globalContext.get('workspace');
const editor = workspace.isActive ? workspace.window.editor : globalContext.get('editor');
const designer = editor.get('designer');
const editor = workspace.isActive ? workspace.window?.editor : globalContext.get('editor');
const designer = editor?.get('designer');
const node = designer?.currentSelection?.getNodes()?.[0];
const npm = node?.componentMeta?.npm;
const selected =
Expand Down
1 change: 1 addition & 0 deletions packages/workspace/src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export class Workspace implements IWorkspace {
readonly shellModelFactory: any,
) {
this.context = new BasicContext(this, '', IPublicEnumPluginRegisterLevel.Workspace);
this.context.innerHotkey.activate(true);
makeObservable(this);
}

Expand Down

0 comments on commit d21b2dc

Please sign in to comment.