Browse Source

Override locale seperator consistently (#3253)

Jaco Greeff 4 years ago
parent
commit
ddebfec73e

+ 0 - 1
packages/apps/public/index.html

@@ -3,7 +3,6 @@
   <head>
     <meta charset="utf-8">
     <meta name="theme-color" content="#000000">
-    <meta http-equiv="X-Frame-Options" content="deny">
     <link rel="manifest" href="manifest.json">
     <link rel="shortcut icon" href="favicon.ico">
     <title><%= htmlWebpackPlugin.options.PAGE_TITLE %></title>

+ 5 - 5
packages/react-components/src/Input.tsx

@@ -52,10 +52,10 @@ interface Props {
   withEllipsis?: boolean;
 }
 
-// Find decimal separator used in current locale
-const getDecimalSeparator = (): string => 1.1
-  .toLocaleString()
-  .replace(/\d/g, '');
+// // Find decimal separator used in current locale
+// const getDecimalSeparator = (): string => 1.1
+//   .toLocaleString()
+//   .replace(/\d/g, '');
 
 // note: KeyboardEvent.keyCode and KeyboardEvent.which are deprecated
 const KEYS = {
@@ -67,7 +67,7 @@ const KEYS = {
   C: 'c',
   CMD: 'Meta',
   CTRL: 'Control',
-  DECIMAL: getDecimalSeparator(),
+  // DECIMAL: getDecimalSeparator(),
   ENTER: 'Enter',
   ESCAPE: 'Escape',
   TAB: 'Tab',

+ 4 - 2
packages/react-components/src/InputNumber.tsx

@@ -13,7 +13,7 @@ import { BN_ZERO, BN_TEN, formatBalance, isBn } from '@polkadot/util';
 import { classes } from './util';
 import { BitLengthOption } from './constants';
 import Dropdown from './Dropdown';
-import Input, { KEYS, KEYS_PRE } from './Input';
+import Input, { KEYS_PRE } from './Input';
 import { useTranslation } from './translate';
 
 interface Props {
@@ -59,9 +59,11 @@ function getGlobalMaxValue (bitLength?: number): BN {
 }
 
 function getRegex (isDecimal: boolean): RegExp {
+  const decimal = '.';
+
   return new RegExp(
     isDecimal
-      ? `^(0|[1-9]\\d*)(\\${KEYS.DECIMAL}\\d*)?$`
+      ? `^(0|[1-9]\\d*)(\\${decimal}\\d*)?$`
       : '^(0|[1-9]\\d*)$'
   );
 }