-
Notifications
You must be signed in to change notification settings - Fork 420
add support for paste event given allowedDecimalSeparators #556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
5935daf
10b28fa
1375431
f98d284
81fce43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -671,6 +671,15 @@ class NumberFormat extends React.Component { | |
| ); | ||
| } | ||
|
|
||
| /** Check for "paste event" with, replace any allowed decimal separator with desired decimal separator. Issue #349 */ | ||
| if (!format && decimalScale !== 0 && allowedDecimalSeparators.some(separator => value.indexOf(separator) !== -1)) { | ||
| let result = value; | ||
| allowedDecimalSeparators.forEach(v => { | ||
| result = result.replace(v, decimalSeparator); | ||
| }) | ||
| value = result; | ||
| } | ||
|
||
|
|
||
| const leftBound = !!format ? 0 : prefix.length; | ||
| const rightBound = lastValue.length - (!!format ? 0 : suffix.length); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.