html encoder for currency symbols
This commit is contained in:
parent
29113cffe8
commit
a7ed5f0c85
|
@ -2,13 +2,15 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import he from 'he';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import classNames from 'classnames';
|
||||
import { isEqual, partial } from 'lodash';
|
||||
import { get, isEqual, partial } from 'lodash';
|
||||
import { Component, createRef } from '@wordpress/element';
|
||||
import { IconButton, SelectControl } from '@wordpress/components';
|
||||
import PropTypes from 'prop-types';
|
||||
import { interpolateViridis as d3InterpolateViridis } from 'd3-scale-chromatic';
|
||||
import { formatDefaultLocale as d3FormatDefaultLocale } from 'd3-format';
|
||||
import Gridicon from 'gridicons';
|
||||
|
||||
/**
|
||||
|
@ -21,6 +23,13 @@ import { updateQueryString } from 'lib/nav-utils';
|
|||
|
||||
const WIDE_BREAKPOINT = 1100;
|
||||
|
||||
d3FormatDefaultLocale( {
|
||||
decimal: '.',
|
||||
thousands: ',',
|
||||
grouping: [ 3 ],
|
||||
currency: [ he.decode( get( wcSettings, 'currency.symbol', '' ) ), '' ],
|
||||
} );
|
||||
|
||||
function getOrderedKeys( props ) {
|
||||
const updatedKeys = [
|
||||
...new Set(
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
* External dependencies
|
||||
*/
|
||||
|
||||
import { findIndex, get } from 'lodash';
|
||||
import { findIndex } from 'lodash';
|
||||
import { max as d3Max } from 'd3-array';
|
||||
import { axisBottom as d3AxisBottom, axisLeft as d3AxisLeft } from 'd3-axis';
|
||||
import { format as d3Format, formatDefaultLocale as d3FormatDefaultLocale } from 'd3-format';
|
||||
import { format as d3Format } from 'd3-format';
|
||||
import {
|
||||
scaleBand as d3ScaleBand,
|
||||
scaleLinear as d3ScaleLinear,
|
||||
|
@ -20,16 +20,6 @@ import { line as d3Line } from 'd3-shape';
|
|||
*/
|
||||
import { formatCurrency } from 'lib/currency';
|
||||
|
||||
function decodeSymbol( str ) {
|
||||
return str.replace( /&#(\d+);/g, ( match, dec ) => String.fromCharCode( dec ) );
|
||||
}
|
||||
|
||||
d3FormatDefaultLocale( {
|
||||
decimal: '.',
|
||||
thousands: ',',
|
||||
grouping: [ 3 ],
|
||||
currency: [ decodeSymbol( get( wcSettings, 'currency.symbol', '' ) ), '' ],
|
||||
} );
|
||||
/**
|
||||
* Describes `getUniqueKeys`
|
||||
* @param {array} data - The chart component's `data` prop.
|
||||
|
|
|
@ -8190,6 +8190,11 @@
|
|||
"minimalistic-assert": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"he": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
|
||||
"integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0="
|
||||
},
|
||||
"history": {
|
||||
"version": "4.7.2",
|
||||
"resolved": "https://registry.npmjs.org/history/-/history-4.7.2.tgz",
|
||||
|
|
|
@ -99,6 +99,7 @@
|
|||
"d3-selection": "^1.3.0",
|
||||
"d3-shape": "^1.2.0",
|
||||
"d3-time-format": "^2.1.1",
|
||||
"he": "^1.1.1",
|
||||
"lodash": "^4.17.10",
|
||||
"react-dates": "^16.7.0",
|
||||
"react-slot-fill": "^2.0.1",
|
||||
|
|
Loading…
Reference in New Issue