Skip to content

Commit 74dbbc4

Browse files
authored
Merge pull request #1288 from plotly/sub-sup-style
allow style field with sub and sup in text
2 parents d70fc9a + c163533 commit 74dbbc4

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/lib/svg_text_utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ function convertToSVG(_str) {
335335
// most of the svg css users will care about is just like html,
336336
// but font color is different. Let our users ignore this.
337337
extraStyle = extraStyle[1].replace(/(^|;)\s*color:/, '$1 fill:');
338-
style = (style ? style + ';' : '') + encodeForHTML(extraStyle);
338+
style = encodeForHTML(extraStyle) + (style ? ';' + style : '');
339339
}
340340

341341
return tspanStart + (style ? ' style="' + style + '"' : '') + '>';

test/image/baselines/annotations.png

2.4 KB
Loading

test/image/mocks/annotations.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"ax":-34,"ay":37,"arrowsize":2,"x":4,"y":1
3939
},
4040
{
41-
"text":"All together","opacity":0.6,"arrowwidth":5,"arrowhead":3,"ax":-77,"ay":-5,
41+
"text":"All together<br>with<sup style=\"font-family:raleway;fill:rgb(0,255,255)\">STYLE</sup>",
42+
"opacity":0.6,"arrowwidth":5,"arrowhead":3,"ax":-77,"ay":-5,
4243
"bordercolor":"rgb(255, 0, 0)","borderwidth":4,"bgcolor":"rgba(255,255,0,0.5)",
4344
"font":{"color":"rgb(0, 0, 255)","size":20},
4445
"arrowcolor":"rgb(166, 28, 0)","borderpad":3,"textangle":50,"x":5,"y":1

0 commit comments

Comments
 (0)