'Problem pasting images with @HostListener in Angular (inputs can't receive text from clipboard)

I implemented a code using the @HostListener from '@angular/core' to get images from the clipboard, however, this code is preventing any input on the screen from being able to receive a copied text.

  @HostListener('paste', ['$event'])
  onPaste(event: any): void {
    const files = (event.clipboardData || event.originalEvent.clipboardData).items;
    ...
  }

Ever i paste a text in some input, onPaste method ins called and the input cannot edited by clipboard.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source