Skip to content

Commit db36b54

Browse files
authored
Merge pull request #574 from plotly/fix-example-custom
Fix example custom
2 parents 0efffa7 + 2bc19f6 commit db36b54

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

examples/custom/src/App.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React, {Component} from 'react';
2+
import PropTypes from 'prop-types';
23
import plotly from 'plotly.js/dist/plotly';
34
import PlotlyEditor from 'react-chart-editor';
45
import CustomEditor from './CustomEditor';
6+
import {localizeString} from 'react-chart-editor/lib';
57
import 'react-chart-editor/lib/react-chart-editor.css';
68

79
const dataSources = {
@@ -33,6 +35,12 @@ class App extends Component {
3335
};
3436
}
3537

38+
getChildContext() {
39+
return {
40+
localize: key => localizeString({}, 'en', key),
41+
};
42+
}
43+
3644
render() {
3745
return (
3846
<div className="app">
@@ -58,4 +66,8 @@ class App extends Component {
5866
}
5967
}
6068

69+
App.childContextTypes = {
70+
localize: PropTypes.func,
71+
};
72+
6173
export default App;

src/components/fields/TextEditor.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ UnconnectedTextEditor.propTypes = {
8484
updatePlot: PropTypes.func,
8585
};
8686

87+
UnconnectedTextEditor.contextTypes = {
88+
localize: PropTypes.func,
89+
};
90+
8791
export default connectToContainer(UnconnectedTextEditor, {
8892
modifyPlotProps: (props, context, plotProps) => {
8993
if (plotProps.isVisible && plotProps.multiValued) {

0 commit comments

Comments
 (0)