11import { isEqual } from 'lodash' ;
22import { globalContext } from './di' ;
3- import { IPublicTypeHotkeyCallback , IPublicTypeHotkeyCallbackConfig , IPublicTypeHotkeyCallbacks , IPublicApiHotkey } from '@alilc/lowcode-types' ;
3+ import { IPublicTypeHotkeyCallback , IPublicTypeHotkeyCallbackConfig , IPublicTypeHotkeyCallbacks , IPublicApiHotkey , IPublicTypeDisposable } from '@alilc/lowcode-types' ;
44
55interface KeyMap {
66 [ key : number ] : string ;
@@ -339,11 +339,10 @@ function fireCallback(callback: IPublicTypeHotkeyCallback, e: KeyboardEvent, com
339339 }
340340}
341341
342- export interface IHotKey extends Omit < IPublicApiHotkey , 'bind' | 'callbacks' > {
343- activate ( activate : boolean ) : void ;
342+ export interface IHotKey extends Hotkey {
344343}
345344
346- export class Hotkey implements IHotKey {
345+ export class Hotkey implements Omit < IPublicApiHotkey , 'bind' | 'callbacks' > {
347346 callBacks : IPublicTypeHotkeyCallbacks = { } ;
348347
349348 private directMap : HotkeyDirectMap = { } ;
@@ -368,7 +367,7 @@ export class Hotkey implements IHotKey {
368367 this . isActivate = activate ;
369368 }
370369
371- mount ( window : Window ) {
370+ mount ( window : Window ) : IPublicTypeDisposable {
372371 const { document } = window ;
373372 const handleKeyEvent = this . handleKeyEvent . bind ( this ) ;
374373 document . addEventListener ( 'keypress' , handleKeyEvent , false ) ;
@@ -542,6 +541,8 @@ export class Hotkey implements IHotKey {
542541 }
543542
544543 private handleKeyEvent ( e : KeyboardEvent ) : void {
544+ console . log ( e ) ;
545+ // debugger;
545546 if ( ! this . isActivate ) {
546547 return ;
547548 }
0 commit comments