-
Notifications
You must be signed in to change notification settings - Fork 625
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
feat!: updated plugins/field-date
to TypeScript
#1705
Conversation
650a384
to
239ade4
Compare
e5a71f2
to
86324dc
Compare
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.
So excited to remove the last last vestige of closure library :D
@@ -97,7 +119,7 @@ suite('FieldDate', function() { | |||
}); | |||
test('New Value', function() { |
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 know all of the validater tests already existed, but could you update them to have some more informative names? Not a high priority though if you just want to get this merged!
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.
Done!
plugins/field-date/README.md
Outdated
@@ -49,8 +51,7 @@ Blockly.defineBlocksWithJsonArray([ | |||
}]); | |||
``` | |||
|
|||
[View the developer documentation](https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/date) for further usage examples. | |||
- [View the developer documentation](https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/date) for further usage examples. |
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.
Does this still conform to the documented API? Even after your changes related to date parsing? My reading is that it does, but wanted to check!
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.
Looks like the link is no longer available, actually. I'm assuming this was originally in the core repo, though since it's in plugins now it's no longer documented there.
I went ahead and removed this link.
plugins/field-date/src/field_date.ts
Outdated
protected showEditor_(e?: Event, _quietInput?: boolean) { | ||
if (this.sourceBlock_) { | ||
// NOTE: Disable modal inputs to use default browser inputs on mobile. | ||
this.sourceBlock_.workspace.options.modalInputs = false; |
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'm not sure that we want to disable modalinputs for the whole workspace to get the date picker to work. I would rather:
- Pass
quietInput
astrue
to super, but focus on it anyway. - Tell external devs to disable modal inputs in their workspace config if they want to use this plugin. We could also log a warning from here if we run into enabled
modalInputs
.
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 went ahead and implemented option 1
of your suggestions. It seemed the least invasive. TBH, I'm not in tune with the use case of needing to set quietInput + avoid focusing on the input, though, so I'm not sure how important that is.
plugins/field-date
to TypeScriptplugins/field-date
to TypeScript
|
||
const tooltipConfig: FieldDateFromJsonConfig = { | ||
date: '2021-03-13', | ||
tooltip: 'This date block has a tooltip!', |
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.
Thanks for adding a new test block for this =)
Notes
goog.require
imports, which included the custom date pickerpackage-lock.json
files afternpm run clean:node
andnpm run boot
at the root folder.blockly: ^10.0.0
, matching their corresponding blockly declarations that are already set to that version.Changes
TypeScript
nowBreaking Changes
::-webkit-calendar-picker-indicator
, though they're inconsistent across browsers.yyyy-mm-dd
) to the browser default for date input.tooltip
config option is now passed to parent components, so it works instead of being ignored!spellcheck?: never
since it isn't used forFieldDate
textEdit
option. Previously, this allowed using the Date Picker while disabling the text input. This cannot be done with the default browser input, as disabling the input disables the picker associated with it.