Include non-block (button) toolbox items in toolbox-search
Check for duplicates
- [x] I have searched for similar issues before opening a new one.
Component
toolbox-search
Problem
No response
Request
The toolbox-search plugin currently only indexes blocks. It should also index and search flyout buttons, e.g. the Create Variable button should be shown in the toolbox when searching for "variable".
Alternatives considered
No response
Additional context
No response
To work on this bug:
- Run
npm installat the root of the repository to install all parts ofblockly-samples cdtoplugins/toolbox-search- Run
npm run startto open a playground and verify that the toolbox search plugin works for you - Make code changes (see below)
- Verify that the changes work in the playground as expected
The code that indexes blocks is initBlockSearcher in src/toolbox_search.ts. It calls getAvailableBlocks to check toolbox definitions for blocks.
- A similar function needs to be created to look for buttons, which have kind
button, and it then needs to be wired into search in a similar way to blocks. matchBlocksneeds to be updated to add buttons into the toolbox, instead of just blocks.
To test, check that you get the Create Variable button when searching "variable", and check that clicking it actually creates a variable.
hi! I would like to work on this issue
Heya @firangizg We have limited issues for the second session, so we're planning on having people work in groups! If you're still interested in that, you can join our call in ~20 minutes and we'll give y'all more info =)
Hi team, I am working on this issue. I found out there is no buttons when searching in this.workspace_.options.languageTree.contents, there are only blocks. Therefore, buttons are unsearchable. How should I fix this? Thanks!
I am a GHC OSD afternoon session attendee and I am still working on this issue.
Hi team, I am working on this issue. I found out there is no buttons when searching in this.workspace_.options.languageTree.contents, there are only blocks. Therefore, buttons are unsearchable. How should I fix this? Thanks!
Hello,
Currently dynamic categories aren't being searched, and all of the buttons in the default toolbox exist as part of dynamic categories.
If you create a test toolbox with buttons in it that are not part of dynamic categories, then the buttons will be in the languageTree.contents. So I would recommend creating your own test toolbox on the test page and testing against that! Here are the docs for defining a toolbox.
I hope that helps! If you have any further questions please reply! --Beka