Skip to content

Conversation

@VeraZab
Copy link
Contributor

@VeraZab VeraZab commented Jan 10, 2018

closes: #217
ex

const {onChange, localize: _} = this.props;
let {placeholder, value} = this.props;

if (value.startsWith('Click to enter') && value.endsWith('title')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or @alexcjohnson would you know of a better way for me to get that default string when title's not set?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, that way isn't going to work with i18n anyway. Is it possible to compare the value from fullLayout with the value from layout? If they're different, I think that's a robust signal that you have the placeholder. And if you explicitly typed in the placeholder, then it's not really a placeholder anymore :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're not comfortable using the plotly.js placeholder verbatim, I think we'd have to explicitly make and localize a new placeholder for each attribute that uses this. Doesn't seem worth it to me, frankly; I'd either use the one from plotly.js or use a standard placeholder for every text entry box.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we could use those plotly.js strings verbatim, it's easier for localization too, like you mention, so I'll put those strings as placeholders then, not values

@VeraZab
Copy link
Contributor Author

VeraZab commented Jan 10, 2018

ready for review @alexcjohnson @bpostlethwaite

@VeraZab
Copy link
Contributor Author

VeraZab commented Jan 10, 2018

ex

container (equivalent of layout) is giving me that attribute's immediate container, so if I'm in xaxis, it's that xaxis object, not the full gd.layout object.

and fullValue is taken from gd._fullValue

so this seems to work ok to me
@alexcjohnson ?

@VeraZab
Copy link
Contributor Author

VeraZab commented Jan 10, 2018

oups, I forgot to also check against attr
so attr === 'title' && !container.title, seems to be what I need to check against

@alexcjohnson
Copy link
Collaborator

Great! I'm happy with this, thanks for iterating through it with me. 💃

@VeraZab
Copy link
Contributor Author

VeraZab commented Jan 10, 2018

thanks!

@VeraZab VeraZab merged commit 98fa0ee into master Jan 10, 2018
@VeraZab VeraZab deleted the axes-title-input branch January 10, 2018 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Axes title input does not reset when adding initial input

3 participants