Skip to content

Commit 8a5eeec

Browse files
committed
looser placeholder check in titles
for old-style placeholder that contained the axis number caught by test image 19
1 parent 7d057e5 commit 8a5eeec

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/titles/index.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ var interactConstants = require('../../constants/interactions');
2222

2323
var Titles = module.exports = {};
2424

25+
var numStripRE = / [XY][0-9]* /;
26+
2527
/**
2628
* Titles - (re)draw titles on the axes and plot:
2729
* @param {DOM element} gd - the graphDiv
@@ -78,7 +80,11 @@ Titles.draw = function(gd, titleClass, options) {
7880
var editable = gd._context.edits[editAttr];
7981

8082
if(txt === '') opacity = 0;
81-
else if(txt === placeholder) {
83+
// look for placeholder text while stripping out numbers from eg X2, Y3
84+
// this is just for backward compatibility with the old version that had
85+
// "Click to enter X2 title" and may have gotten saved in some old plots,
86+
// we don't want this to show up when these are displayed.
87+
else if(txt.replace(numStripRE, ' % ') === placeholder.replace(numStripRE, ' % ')) {
8288
opacity = 0.2;
8389
isplaceholder = true;
8490
if(!editable) txt = '';

0 commit comments

Comments
 (0)