OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Override Ctrl+n with Typescript

  • Thread starter Thread starter BennoDual
  • Start date Start date
B

BennoDual

Guest
I am searching a way to override Ctrl-N with Typescript. I use Chrome-Browser.

I have tried this:

Code:
@HostListener('window:keydown', ['$event'])
onKeyDown_deleteCurrentLine(event: KeyboardEvent) {
   if (event.ctrlKey && event.key === 'n') {
       event.preventDefault();

       this.createNewLine();
   }
}

but it will still always open a new Browser-Window.

I hope, someone can help me. Thank you.

<p>I am searching a way to override Ctrl-N with Typescript. I use Chrome-Browser.</p>
<p>I have tried this:</p>
<pre><code>@HostListener('window:keydown', ['$event'])
onKeyDown_deleteCurrentLine(event: KeyboardEvent) {
if (event.ctrlKey && event.key === 'n') {
event.preventDefault();

this.createNewLine();
}
}
</code></pre>
<p>but it will still always open a new Browser-Window.</p>
<p>I hope, someone can help me. Thank you.</p>
 

Latest posts

Top