@@ -198,6 +198,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
198198 dataExpStep = wizbar . addStep ( { title : highed . getLocalizedStr ( 'stepExport' ) , id : 'export' } ) ,
199199 dataExp = highed . Exporter ( dataExpStep . body , properties . exporter ) ,
200200
201+ chartIcon = highed . dom . cr ( 'div' , 'highed-chart-container-icon' ) ,
202+
201203 cmenu = highed . DefaultContextMenu ( chartPreview )
202204
203205 ;
@@ -208,6 +210,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
208210
209211 ///////////////////////////////////////////////////////////////////////////
210212
213+ function updateToolbarIcon ( ) {
214+ if ( highed . onPhone ( ) ) {
215+ highed . dom . style ( chartIcon , {
216+ 'background-image' : 'url("data:image/svg+xml;utf8,' +
217+ encodeURIComponent ( chartPreview . export . svg ( ) ) +
218+ '")'
219+ } ) ;
220+ }
221+ }
222+
211223 //Hide features that are disabled
212224 function applyFeatures ( ) {
213225 var things = highed . arrToObj ( properties . features . split ( ' ' ) ) ;
@@ -341,7 +353,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
341353 } ) ;
342354
343355 //Route preview events
344- chartPreview . on ( 'ChartChange' , function ( newData ) { events . emit ( 'ChartChange' , newData ) ; } ) ;
356+ chartPreview . on ( 'ChartChange' , function ( newData ) {
357+ events . emit ( 'ChartChange' , newData ) ;
358+
359+ } ) ;
345360 chartPreview . on ( 'ChartChangeLately' , function ( newData ) { events . emit ( 'ChartChangeLately' , newData ) ; } ) ;
346361
347362 ///////////////////////////////////////////////////////////////////////////
@@ -359,6 +374,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
359374 highed . log ( 2 , 'on object in editor properties is not a valid object' ) ;
360375 }
361376
377+
378+
362379 //Activate plugins
363380 properties . plugins = highed . arrToObj ( properties . plugins ) ;
364381 Object . keys ( properties . plugins ) . forEach ( function ( name ) {
@@ -367,6 +384,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
367384
368385 //Dispatch change events to the active plugins
369386 chartPreview . on ( 'ChartChangeLately' , function ( options ) {
387+
388+ updateToolbarIcon ( ) ;
389+
370390 Object . keys ( activePlugins ) . forEach ( function ( key ) {
371391 var plugin = activePlugins [ key ] ;
372392 if ( highed . isFn ( plugin . definition . chartchange ) ) {
@@ -379,14 +399,31 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
379399
380400 applyFeatures ( ) ;
381401
402+
403+ chartCustomizer . init ( chartPreview . options . customized , chartPreview . options . chart ) ;
404+
405+ if ( highed . onPhone ( ) ) {
406+ chartContainer . className = 'highed-chart-container-icon' ;
407+ highed . dom . ap ( mainToolbar . right , chartIcon ) ;
408+
409+ highed . dom . on ( chartIcon , 'click' , function ( e ) {
410+ chartPreview . expand ( ) ;
411+ e . cancelBubble = true ;
412+ e . preventDefault ( ) ;
413+ e . stopPropagation ( ) ;
414+ e . stopImmediatePropagation ( ) ;
415+ return false ;
416+ } ) ;
417+ }
418+
382419 mainToolbar . addIcon ( {
383420 css : 'fa-bars' ,
384421 click : function ( e ) {
385422 cmenu . show ( e . clientX , e . clientY ) ;
386423 }
387424 } ) ;
388425
389- chartCustomizer . init ( chartPreview . options . customized , chartPreview . options . chart ) ;
426+ updateToolbarIcon ( ) ;
390427
391428 ///////////////////////////////////////////////////////////////////////////
392429
0 commit comments