-
Notifications
You must be signed in to change notification settings - Fork 633
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: create plugin with renderer that treats dummy inputs as row separators. #1398
Conversation
Beka pointed out that there's a request at google/blockly#216 for adding line-breaks between inline inputs (or in this case fields?) that I think could be addressed by this plugin. |
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.
At a high level, I'm wondering if this would be better as a demo than a plugin? Since really, external devs might want to apply this to whatever their custom renderer is.
Inline I left a comment about using a decorator, which I think would also solve the problem of wanting to apply this to multiple renderers. But I don't think a decorator pattern makes sense when the RenderInfo
interface is so large.
Besides that high level decision, looks really good! Also, thanks for going through and cleaning up the package.json, looks great =)
plugins/inline-row-separators/src/inline_row_separators_renderer.ts
Outdated
Show resolved
Hide resolved
plugins/inline-row-separators/test/inline_row_separators_test.mocha.js
Outdated
Show resolved
Hide resolved
I believe I was able to use TypeScript's mixin feature to allow this plugin to add the inline-row-separator feature to any Blockly Renderer! |
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! Approximately 50% nits and 50% compliments :P Thank you for your work on this John!
Once the nits are fixed up I'll merge this, and it'll either go out next Thursday, or before then if we can figure out #1452
Related to: google/blockly#2062
Creates a plugin that registers a renderer that treats dummy inputs as row separators. This is useful for putting adjacent inline value input connectors on separate rows, which was previously only possible for external value input connectors in the default renderer.
This plugin also defines some alternatives to built-in blocks that demonstrate the feature, and optionally allows overriding the built-in blocks themselves.
The renderer and the new block definitions override methods with names that end in an underscore, so I had to disable eslint for those names.
This plugin is a proof-of-concept. I suggest that Blockly should eventually support putting \n characters in block JSON message0 to accomplish the same effect. Note that I originally intended to create a renderer that supports indented external value input connectors, but decided that inline value input connectors are easier to implement and more idiomatic for some use-cases. (Although I still think that indented external value input connectors would be useful for growable lists of values.)