Skip to content

Commit

Permalink
Merge pull request #15568 from qburst/fix--15567
Browse files Browse the repository at this point in the history
fix: disable paste function on readonly mode
  • Loading branch information
cetincakiroglu authored May 15, 2024
2 parents 21b49bc + 7d83b18 commit ac55ac3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/app/components/inputotp/inputotp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,20 @@ export class InputOtp implements AfterContentInit {
}

onPaste(event) {
let paste = event.clipboardData.getData('text');
if (!this.disabled && !this.readonly) {
let paste = event.clipboardData.getData('text');

if (paste.length) {
let pastedCode = paste.substring(0, this.length + 1);
if (paste.length) {
let pastedCode = paste.substring(0, this.length + 1);

if (!this.integerOnly || !isNaN(pastedCode)) {
this.tokens = pastedCode.split('');
this.updateModel(event);
if (!this.integerOnly || !isNaN(pastedCode)) {
this.tokens = pastedCode.split('');
this.updateModel(event);
}
}
}

event.preventDefault();
event.preventDefault();
}
}

getRange(n: number): number[] {
Expand Down

0 comments on commit ac55ac3

Please sign in to comment.