@@ -342,37 +342,8 @@ function positionPlayWithData(gd, container){
342342 . text ( gd . _context . linkText + ' ' + String . fromCharCode ( 187 ) ) ;
343343
344344 if ( gd . _context . sendData ) {
345- link . on ( 'click' , function ( ) {
346- gd . emit ( 'plotly_beforeexport' ) ;
347-
348- var baseUrl = ( window . PLOTLYENV && window . PLOTLYENV . BASE_URL ) || 'https://plot.ly' ;
349-
350- var hiddenformDiv = d3 . select ( gd )
351- . append ( 'div' )
352- . attr ( 'id' , 'hiddenform' )
353- . style ( 'display' , 'none' ) ;
354-
355- var hiddenform = hiddenformDiv
356- . append ( 'form' )
357- . attr ( {
358- action : baseUrl + '/external' ,
359- method : 'post' ,
360- target : '_blank'
361- } ) ;
362-
363- var hiddenformInput = hiddenform
364- . append ( 'input' )
365- . attr ( {
366- type : 'text' ,
367- name : 'data'
368- } ) ;
369-
370- hiddenformInput . node ( ) . value = plots . graphJson ( gd , false , 'keepdata' ) ;
371- hiddenform . node ( ) . submit ( ) ;
372- hiddenformDiv . remove ( ) ;
373-
374- gd . emit ( 'plotly_afterexport' ) ;
375- return false ;
345+ link . on ( 'click' , function ( ) {
346+ plots . sendDataToCloud ( gd )
376347 } ) ;
377348 }
378349 else {
@@ -384,6 +355,38 @@ function positionPlayWithData(gd, container){
384355 } ) ;
385356 }
386357}
358+ plots . sendDataToCloud = function ( gd ) {
359+ gd . emit ( 'plotly_beforeexport' ) ;
360+
361+ var baseUrl = ( window . PLOTLYENV && window . PLOTLYENV . BASE_URL ) || 'https://plot.ly' ;
362+
363+ var hiddenformDiv = d3 . select ( gd )
364+ . append ( 'div' )
365+ . attr ( 'id' , 'hiddenform' )
366+ . style ( 'display' , 'none' ) ;
367+
368+ var hiddenform = hiddenformDiv
369+ . append ( 'form' )
370+ . attr ( {
371+ action : baseUrl + '/external' ,
372+ method : 'post' ,
373+ target : '_blank'
374+ } ) ;
375+
376+ var hiddenformInput = hiddenform
377+ . append ( 'input' )
378+ . attr ( {
379+ type : 'text' ,
380+ name : 'data'
381+ } ) ;
382+
383+ hiddenformInput . node ( ) . value = plots . graphJson ( gd , false , 'keepdata' ) ;
384+ hiddenform . node ( ) . submit ( ) ;
385+ hiddenformDiv . remove ( ) ;
386+
387+ gd . emit ( 'plotly_afterexport' ) ;
388+ return false ;
389+ }
387390
388391plots . supplyDefaults = function ( gd ) {
389392 // fill in default values:
0 commit comments