@@ -77,7 +77,8 @@ exports.convertToTspans = function(_context, gd, _callback) {
7777 if ( tex ) {
7878 ( ( gd && gd . _promises ) || [ ] ) . push ( new Promise ( function ( resolve ) {
7979 _context . style ( 'display' , 'none' ) ;
80- var config = { fontSize : parseInt ( _context . style ( 'font-size' ) , 10 ) } ;
80+ var fontSize = parseInt ( _context . node ( ) . style . fontSize , 10 ) ;
81+ var config = { fontSize : fontSize } ;
8182
8283 texToSVG ( tex [ 2 ] , config , function ( _svgEl , _glyphDefs , _svgBBox ) {
8384 parent . selectAll ( 'svg.' + svgClass ) . remove ( ) ;
@@ -113,16 +114,15 @@ exports.convertToTspans = function(_context, gd, _callback) {
113114 } )
114115 . style ( { overflow : 'visible' , 'pointer-events' : 'none' } ) ;
115116
116- var fill = _context . style ( 'fill' ) || 'black' ;
117+ var fill = _context . node ( ) . style . fill || 'black' ;
117118 newSvg . select ( 'g' ) . attr ( { fill : fill , stroke : fill } ) ;
118119
119120 var newSvgW = getSize ( newSvg , 'width' ) ,
120121 newSvgH = getSize ( newSvg , 'height' ) ,
121122 newX = + _context . attr ( 'x' ) - newSvgW *
122123 { start : 0 , middle : 0.5 , end : 1 } [ _context . attr ( 'text-anchor' ) || 'start' ] ,
123124 // font baseline is about 1/4 fontSize below centerline
124- textHeight = parseInt ( _context . style ( 'font-size' ) , 10 ) ||
125- getSize ( _context , 'height' ) ,
125+ textHeight = fontSize || getSize ( _context , 'height' ) ,
126126 dy = - textHeight / 4 ;
127127
128128 if ( svgClass [ 0 ] === 'y' ) {
@@ -598,19 +598,22 @@ exports.makeEditable = function(context, options) {
598598 }
599599
600600 function appendEditable ( ) {
601- var plotDiv = d3 . select ( gd ) ,
602- container = plotDiv . select ( '.svg-container' ) ,
603- div = container . append ( 'div' ) ;
601+ var plotDiv = d3 . select ( gd ) ;
602+ var container = plotDiv . select ( '.svg-container' ) ;
603+ var div = container . append ( 'div' ) ;
604+ var cStyle = context . node ( ) . style ;
605+ var fontSize = parseFloat ( cStyle . fontSize || 12 ) ;
606+
604607 div . classed ( 'plugin-editable editable' , true )
605608 . style ( {
606609 position : 'absolute' ,
607- 'font-family' : context . style ( 'font-family' ) || 'Arial' ,
608- 'font-size' : context . style ( 'font-size' ) || 12 ,
609- color : options . fill || context . style ( ' fill' ) || 'black' ,
610+ 'font-family' : cStyle . fontFamily || 'Arial' ,
611+ 'font-size' : fontSize ,
612+ color : options . fill || cStyle . fill || 'black' ,
610613 opacity : 1 ,
611614 'background-color' : options . background || 'transparent' ,
612615 outline : '#ffffff33 1px solid' ,
613- margin : [ - parseFloat ( context . style ( 'font-size' ) ) / 8 + 1 , 0 , 0 , - 1 ] . join ( 'px ' ) + 'px' ,
616+ margin : [ - fontSize / 8 + 1 , 0 , 0 , - 1 ] . join ( 'px ' ) + 'px' ,
614617 padding : '0' ,
615618 'box-sizing' : 'border-box'
616619 } )
0 commit comments