Skip to content

Commit a20b377

Browse files
bhogan-mitrenicolaskruchten
authored andcommitted
enable toggling the editor display (#453)
1 parent e77bf67 commit a20b377

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

src/PlotlyEditor.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ class PlotlyEditor extends Component {
1313
render() {
1414
return (
1515
<div className="plotly_editor">
16-
<EditorControls
17-
graphDiv={this.state.graphDiv}
18-
dataSources={this.props.dataSources}
19-
dataSourceOptions={this.props.dataSourceOptions}
20-
plotly={this.props.plotly}
21-
onUpdate={this.props.onUpdate}
22-
advancedTraceTypeSelector={this.props.advancedTraceTypeSelector}
23-
locale={this.props.locale}
24-
traceTypesConfig={this.props.traceTypesConfig}
25-
dictionaries={this.props.dictionaries}
26-
>
27-
{this.props.children}
28-
</EditorControls>
16+
{!this.props.hideControls && (
17+
<EditorControls
18+
graphDiv={this.state.graphDiv}
19+
dataSources={this.props.dataSources}
20+
dataSourceOptions={this.props.dataSourceOptions}
21+
plotly={this.props.plotly}
22+
onUpdate={this.props.onUpdate}
23+
advancedTraceTypeSelector={this.props.advancedTraceTypeSelector}
24+
locale={this.props.locale}
25+
traceTypesConfig={this.props.traceTypesConfig}
26+
dictionaries={this.props.dictionaries}
27+
>
28+
{this.props.children}
29+
</EditorControls>
30+
)}
2931
<div
3032
className="plotly_editor_plot"
3133
style={{width: '100%', height: '100%'}}
@@ -65,6 +67,11 @@ PlotlyEditor.propTypes = {
6567
traceTypesConfig: PropTypes.object,
6668
dictionaries: PropTypes.object,
6769
divId: PropTypes.string,
70+
hideControls: PropTypes.bool,
71+
};
72+
73+
PlotlyEditor.defaultProps = {
74+
hideControls: false,
6875
};
6976

7077
export default PlotlyEditor;

0 commit comments

Comments
 (0)