Skip to content

Commit 419be83

Browse files
committed
make default plotly.js titles placeholders
1 parent 03f253a commit 419be83

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/components/fields/TextEditor.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ export class UnconnectedTextEditor extends Component {
6767

6868
let fullValue = this.getAdjustedFullValue(this.props.fullValue);
6969

70-
let placeholder;
70+
let placeholder = this.props.placeholder;
71+
7172
if (multiValued || (fullValue && (!container || !nestedProperty(container, attr)))) {
7273
placeholder = fullValue;
7374
fullValue = '';
@@ -118,16 +119,27 @@ UnconnectedTextEditor.propTypes = {
118119
latexOnly: PropTypes.bool,
119120
richTextOnly: PropTypes.bool,
120121
updatePlot: PropTypes.func,
122+
placeholder: PropTypes.string,
121123
};
122124

123125
UnconnectedTextEditor.contextTypes = {
124126
localize: PropTypes.func,
127+
fullLayout: PropTypes.object,
125128
};
126129

127130
export default connectToContainer(UnconnectedTextEditor, {
128131
modifyPlotProps: (props, context, plotProps) => {
129132
if (plotProps.isVisible && plotProps.multiValued) {
130133
plotProps.isVisible = false;
131134
}
135+
136+
if (
137+
context.fullLayout &&
138+
context.fullLayout._dfltTitle &&
139+
Object.values(context.fullLayout._dfltTitle).includes(plotProps.fullValue)
140+
) {
141+
plotProps.placeholder = plotProps.fullValue;
142+
plotProps.fullValue = '';
143+
}
132144
},
133145
});

0 commit comments

Comments
 (0)