From 2acb692a0e0bafb9f3c27035f9ac48b12ba17a46 Mon Sep 17 00:00:00 2001 From: Vincent Scavinner Date: Mon, 22 Jul 2024 18:03:06 +0200 Subject: [PATCH] fix: prevent default pasting event --- ember-amount-input/src/components/amount-input.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ember-amount-input/src/components/amount-input.ts b/ember-amount-input/src/components/amount-input.ts index b31499f0..187bc327 100644 --- a/ember-amount-input/src/components/amount-input.ts +++ b/ember-amount-input/src/components/amount-input.ts @@ -157,14 +157,17 @@ export default class AmountInput extends Component { @action onPaste(event: ClipboardEvent): boolean { + event.preventDefault(); + const pastedValue = event.clipboardData?.getData('text'); const parsedValue = parseFloat(pastedValue?.replace(/\s/g, '') ?? ''); if (!isNaN(parsedValue)) { this.args.update(parsedValue.toFixed(this.numberOfDecimal)); + return true; } - return true; + return false; } @action