-
Notifications
You must be signed in to change notification settings - Fork 628
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
refactor!: Update and modernize the continuous toolbox plugin. #2468
base: rc/v12.0.0
Are you sure you want to change the base?
Conversation
Might it be worth creating a v12 branch in this repo (if there is not already one) and retargeting this PR to it? |
Done! |
This also fixes #2471. |
And also fixes google/blockly#8543 |
Hello! Any chance this could be built into a beta release or something like that? I'm attempting to use |
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.
Overall this looks good and the preponderance of the comments/suggestions below are 'for your consideration' rather than requests for change.
Nevertheless, I find myself slightly confused about the recycling business. I think it is worth disambiguationg "recycling bin" from "trash", and maybe including a bit more of a high-level overview of purpose and intended behaviour in relevant places (README, class-level JSDocs, etc.) to explain what's going on, because this was definitely the part of the code that I was least confident about my understanding of.
plugins/continuous-toolbox/src/RecyclableBlockFlyoutInflater.ts
Outdated
Show resolved
Hide resolved
plugins/continuous-toolbox/src/RecyclableBlockFlyoutInflater.ts
Outdated
Show resolved
Hide resolved
plugins/continuous-toolbox/src/RecyclableBlockFlyoutInflater.ts
Outdated
Show resolved
Hide resolved
plugins/continuous-toolbox/src/RecyclableBlockFlyoutInflater.ts
Outdated
Show resolved
Hide resolved
return false; | ||
} | ||
if (field instanceof Blockly.FieldDropdown) { | ||
if (field.isOptionListDynamic()) { |
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 mildly concerned about this, since it's possible a FieldDropdown
could have dynamically-updated options without actually using a menu generating function. Hopefully it would save/load extra state and be caught that way—or the developer could override isOptionListDynamic
to always return true, but I think perhaps this deserves:
- A general warning in the README (and release notes) about issues with dynamically-modified blocks and fields when using this plugin, and/or
- A general-purpose way to opt specific block types out of being recycled.
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 still think it would be a good idea to provide a bit more internal documentation about the recycling business, and perhaps also make sure the external documentation mentions the issue with non-obviously mutable blocks, but otherwise this LGTM.
if ( | ||
(block.mutationToDom && block.domToMutation) || | ||
(block.saveExtraState && block.loadExtraState) | ||
) { |
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 can't imagine why a block would get just one of mutationToDom
and domToMutation
(or saveExtraState
and loadExtraState
) but not the matching pair, but perhaps safer to just check if any of them exist?
The basics
The details
Resolves
Proposed Changes
This PR updates the continuous toolbox plugin for compatibility with the revised flyout APIs introduced in Blockly v12. It also converts the plugin to Typescript.
Additionally, it fixes several existing issues:
Blockly.getMainWorkspace().getFlyout().setAutoClose(true)
to enable this behavior.This PR should not be merged until Blockly v12 is released, as it depends upon APIs added in that version.