Skip to content

Commit

Permalink
bugfix(#11): fix capslock paste issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pkovzz committed Jun 29, 2022
1 parent 8cec872 commit 8b75d22
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.11.1] - 2022-06-29

- Bugfix of [Windows copy paste issue](https://github.com/k2peter/ngx-otp-input/issues/11)

## [0.11.0] - 2022-01-04

### Added
Expand Down
8 changes: 4 additions & 4 deletions projects/ngx-otp-input/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-otp-input",
"version": "0.11.0",
"version": "0.11.1",
"peerDependencies": {
"@angular/common": "^11.0.9",
"@angular/core": "^11.0.9"
Expand All @@ -15,12 +15,12 @@
},
"repository": {
"type": "git",
"url": "https://github.com/pkovzz/ngx-otp-input"
"url": "https://github.com/k2peter/ngx-otp-input"
},
"bugs": {
"url": "https://github.com/pkovzz/ngx-otp-input/issues"
"url": "https://github.com/k2peter/ngx-otp-input/issues"
},
"homepage": "https://github.com/pkovzz/ngx-otp-input",
"homepage": "https://github.com/k2peter/ngx-otp-input",
"description": "One time password input library for Angular",
"keywords": [
"one time password",
Expand Down
16 changes: 8 additions & 8 deletions projects/ngx-otp-input/src/lib/pattern.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export class PatternDirective {
@HostListener('keydown', ['$event']) onKeyDown(e: KeyboardEvent): void {
if (
this.allowedKeys.includes(e.key) ||
(e.key === 'a' && e.ctrlKey === true) || // Allow: Ctrl+A
(e.key === 'c' && e.ctrlKey === true) || // Allow: Ctrl+C
(e.key === 'v' && e.ctrlKey === true) || // Allow: Ctrl+V
(e.key === 'x' && e.ctrlKey === true) || // Allow: Ctrl+X
(e.key === 'a' && e.metaKey === true) || // Cmd+A (Mac)
(e.key === 'c' && e.metaKey === true) || // Cmd+C (Mac)
(e.key === 'v' && e.metaKey === true) || // Cmd+V (Mac)
(e.key === 'x' && e.metaKey === true) // Cmd+X (Mac)
(e.code === 'KeyA' && e.ctrlKey === true) || // Allow: Ctrl+A
(e.code === 'KeyC' && e.ctrlKey === true) || // Allow: Ctrl+C
(e.code === 'KeyV' && e.ctrlKey === true) || // Allow: Ctrl+V
(e.code === 'KeyX' && e.ctrlKey === true) || // Allow: Ctrl+X
(e.code === 'KeyA' && e.metaKey === true) || // Cmd+A (Mac)
(e.code === 'KeyC' && e.metaKey === true) || // Cmd+C (Mac)
(e.code === 'KeyV' && e.metaKey === true) || // Cmd+V (Mac)
(e.code === 'KeyX' && e.metaKey === true) // Cmd+X (Mac)
) {
return; // let it happen, don't do anything
} else if (!this.pattern.test(e.key)) {
Expand Down
Empty file.

1 comment on commit 8b75d22

@vercel
Copy link

@vercel vercel bot commented on 8b75d22 Jun 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ngx-otp-input – ./

ngx-otp-input.vercel.app
ngx-otp-input-git-master-k2peter.vercel.app
ngx-otp-input-k2peter.vercel.app

Please sign in to comment.