← All changes
|
classes/Visualizer/Gutenberg/src/Components/Sidebar/FrontendActions.js
+20
-0
3.1.0
→
3.7.2
View file →
| @@ -30,8 +30,9 @@ | ||
| 30 | 30 | |
| 31 | 31 | render() { |
| 32 | 32 | |
| 33 | 33 | const settings = this.props.chart['visualizer-settings']; |
| 34 | + const type = this.props.chart['visualizer-chart-type']; | |
| 34 | 35 | |
| 35 | 36 | return ( |
| 36 | 37 | <PanelBody |
| 37 | 38 | title={ __( 'Frontend Actions' ) } |
| @@ -109,8 +110,27 @@ | ||
| 109 | 110 | } |
| 110 | 111 | this.props.edit( settings ); |
| 111 | 112 | } } |
| 112 | 113 | /> |
| 114 | + | |
| 115 | + { ( -1 >= [ 'dataTable', 'tabular', 'gauge', 'table' ].indexOf( type ) ) && ( | |
| 116 | + <CheckboxControl | |
| 117 | + label={ __( 'Download Image' ) } | |
| 118 | + help={ __( 'To download the chart as an image.' ) } | |
| 119 | + checked={ ( 0 <= settings.actions.indexOf( 'image' ) ) } | |
| 120 | + onChange={ e => { | |
| 121 | + if ( 0 <= settings.actions.indexOf( 'image' ) ) { | |
| 122 | + const index = settings.actions.indexOf( 'image' ); | |
| 123 | + if ( -1 !== index ) { | |
| 124 | + settings.actions.splice( index, 1 ); | |
| 125 | + } | |
| 126 | + } else { | |
| 127 | + settings.actions.push( 'image' ); | |
| 128 | + } | |
| 129 | + this.props.edit( settings ); | |
| 130 | + } } | |
| 131 | + /> | |
| 132 | + ) } | |
| 113 | 133 | |
| 114 | 134 | </Fragment> |
| 115 | 135 | |
| 116 | 136 | ) } |