Skip to content

Commit

Permalink
fix: fix moustrap imports, fix rxjs peer deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Coffee-Tea committed Feb 5, 2022
1 parent eda047d commit defa682
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ npm-debug.log
yarn-error.log
testem.log
/typings
.angular

# System Files
.DS_Store
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
"bugs": {
"url": "[email protected]:brtnshrdr/angular2-hotkeys.git/issues"
},
"peerDependencies": {
"rxjs": "^5.5.0 || ^6.0.0"
},
"dependencies": {
"@types/mousetrap": "^1.6.9",
"mousetrap": "^1.6.5",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/hotkeys.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export class HotkeysDirective implements OnInit, OnDestroy {
private oldHotkeys: Hotkey[] = [];

constructor(private hotkeysService: HotkeysService, private elementRef: ElementRef) {
this.mousetrap = new Mousetrap(this.elementRef.nativeElement); // Bind hotkeys to the current element (and any children)
// Bind hotkeys to the current element (and any children)
this.mousetrap = new (Mousetrap as any).default(this.elementRef.nativeElement);
}

ngOnInit() {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/hotkeys.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Hotkey } from './hotkey.model';
import { Subject } from 'rxjs';
import { HotkeyOptions, IHotkeyOptions } from './hotkey.options';
import { MousetrapInstance } from 'mousetrap';
import * as Mousetrap from "mousetrap";
import * as Mousetrap from 'mousetrap';

@Injectable({
providedIn: 'root'
Expand All @@ -25,7 +25,7 @@ export class HotkeysService {
}
return (element.contentEditable && element.contentEditable === 'true');
};
this.mousetrap = new (Mousetrap as any)();
this.mousetrap = new (Mousetrap as any).default();
this.initCheatSheet();
}

Expand Down

0 comments on commit defa682

Please sign in to comment.