Skip to content

Commit 1cc7ce5

Browse files
PR comments
1 parent a5abe96 commit 1cc7ce5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

classes/Visualizer/Module/Frontend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function renderChart( $atts ) {
252252
$actions_div .= '<a href="#" class="visualizer-action visualizer-action-' . $key . '" data-visualizer-type="' . $key . '" data-visualizer-chart-id="' . $atts['id'] . '" data-visualizer-mime="' . $mime . '" title="' . $label . '" ';
253253

254254
if ( 'copy' === $key ) {
255-
$copy = $this->_getDataAs( $atts['id'], 'copy' );
255+
$copy = $this->_getDataAs( $atts['id'], 'csv' );
256256
$actions_div .= ' data-clipboard-text="' . esc_attr( $copy['csv'] ) . '"';
257257
}
258258

js/render.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,12 @@
232232
});
233233

234234
function initActionsButtons() {
235-
var clipboard = new Clipboard('a.visualizer-action[data-visualizer-type=copy]'); // jshint ignore:line
236-
clipboard.on('success', function(e) {
237-
window.alert(v.i10n['copied']);
238-
});
239-
235+
if($('a.visualizer-action[data-visualizer-type=copy]').length > 0) {
236+
var clipboard = new Clipboard('a.visualizer-action[data-visualizer-type=copy]'); // jshint ignore:line
237+
clipboard.on('success', function(e) {
238+
window.alert(v.i10n['copied']);
239+
});
240+
}
240241
$('a.visualizer-action[data-visualizer-type!=copy]').on('click', function(e) {
241242
var type = $(this).attr( 'data-visualizer-type' );
242243
var chart = $(this).attr( 'data-visualizer-chart-id' );

0 commit comments

Comments
 (0)