-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Sending the Bad Value to doValueInvalid #2577
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
core/field_textinput.js
Outdated
* @protected | ||
*/ | ||
Blockly.FieldTextInput.prototype.doValueInvalid_ = function() { | ||
Blockly.FieldTextInput.prototype.doValueInvalid_ = function(_newValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this underscore signify? I'm not familiar with such a naming scheme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that it's just a thing for the eslint, so that it doesn't freak out about an unused variable.
core/field_textinput.js
Outdated
* @protected | ||
*/ | ||
Blockly.FieldTextInput.prototype.doValueInvalid_ = function() { | ||
Blockly.FieldTextInput.prototype.doValueInvalid_ = function(_newValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually thinking about this could you change _newValue to something like _invalidValue? I think it is a bit more clear. sorry for the late comment!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! Can do =)
The basics
The details
Resolves
N/A
Proposed Changes
doValueInvalid_() now recieves the invalid value.
Reason for Changes
Makes it easier for fields to display invalid values if they wish.
This was not added previously because the only core field that uses doValueInvalid is the text input field, and its display value is stored on the htmlInput. But when I was working on the custom fields demo I found that this was useful.
Test Coverage
N/A
Additional Information
N/A