From 173f40f5107745e7c563486f422b599fa6d6a32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Mon, 15 Apr 2024 16:34:47 +0300 Subject: [PATCH] Fixed #12316 - KeyFilter | Pasting Valid data into a pKeyFilter field not possible --- src/app/components/keyfilter/keyfilter.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/components/keyfilter/keyfilter.ts b/src/app/components/keyfilter/keyfilter.ts index b92f0211641..cd9d2f71d55 100755 --- a/src/app/components/keyfilter/keyfilter.ts +++ b/src/app/components/keyfilter/keyfilter.ts @@ -237,12 +237,20 @@ export class KeyFilter implements Validator { onPaste(e: ClipboardEvent) { const clipboardData = e.clipboardData || (this.document.defaultView).clipboardData.getData('text'); if (clipboardData) { + let pattern = /\{[0-9]+\}/; const pastedText = clipboardData.getData('text'); - for (let char of pastedText.toString()) { - if (!this.regex.test(char)) { + if (pattern.test(this.regex.toString())) { + if (!this.regex.test(pastedText)) { e.preventDefault(); return; } + } else { + for (let char of pastedText.toString()) { + if (!this.regex.test(char)) { + e.preventDefault(); + return; + } + } } } }