Searching blocks

313 views
Skip to first unread message

bruh 9000

unread,
Mar 26, 2024, 7:14:28 PM3/26/24
to Blockly
I have 2 things related to the toolbox that I want to know if are possible:

- Adding a search button to find a block you want easily
- Allow scrolling between categories
- - Like in Scratch, I want to make it so you don't have to click in the toolbox to go from category to category, but you can scroll to change categories

Mark Friedman

unread,
Mar 26, 2024, 7:25:35 PM3/26/24
to blo...@googlegroups.com
On Tue, Mar 26, 2024 at 4:14 PM bruh 9000 <bruh90...@gmail.com> wrote:
I have 2 things related to the toolbox that I want to know if are possible:

Good news!  There are Blockly plugins available for each of these:

 
- Adding a search button to find a block you want easily

Assuming that you want to search within your Blockly workspace, you can use the Workspace search plugin.  If you meant searching within your toolbox, then you can use the Toolbox search plugin.

- Allow scrolling between categories
- - Like in Scratch, I want to make it so you don't have to click in the toolbox to go from category to category, but you can scroll to change categories


Hope this helps.

-Mark

bruh 9000

unread,
Mar 26, 2024, 8:00:52 PM3/26/24
to Blockly
Thank you!

For the continuous toolbox plugin, it makes the toolbox always open + also changes the look of the categories. Do you know if there is a way to keep it as normal?

For the workspace search plugin, it has me add <script src="./node_modules/@blockly/plugin-workspace-search/dist/index.js"></script> to my index.html file, but I am not using the same repo as it is in and I don't think it is working correctly, since it is not popping up anything when I press ctrl+f


This is my repo

bruh 9000

unread,
Mar 26, 2024, 8:10:39 PM3/26/24
to Blockly
Sorry, I accidentally misread the message you sent somehow. I meant to use the toolbox search, and I was able to successfully implement it. I still do need help with the question about the continuous toolbox plugin.

Mark Friedman

unread,
Mar 27, 2024, 2:11:05 PM3/27/24
to blo...@googlegroups.com
On Tue, Mar 26, 2024 at 5:00 PM bruh 9000 <bruh90...@gmail.com> wrote:
Thank you!

For the continuous toolbox plugin, it makes the toolbox always open + also changes the look of the categories. Do you know if there is a way to keep it as normal?

I'm not sure how close you can get to "normal", but the documentation for the plugin says "you can customize the style further by following the toolbox documentation."  I would imagine that the Styling section of that doc would be the most help.


For the workspace search plugin, it has me add <script src="./node_modules/@blockly/plugin-workspace-search/dist/index.js"></script> to my index.html file, but I am not using the same repo as it is in and I don't think it is working correctly, since it is not popping up anything when I press ctrl+f

It appears that you are using Webpack to build your app, so I would suggest referring to the npm installation and ES6 Imports sections of the plugin README file.  

-Mark



This is my repo
On Tuesday, March 26, 2024 at 4:25:35 PM UTC-7 mark.f...@gmail.com wrote:
On Tue, Mar 26, 2024 at 4:14 PM bruh 9000 <bruh90...@gmail.com> wrote:
I have 2 things related to the toolbox that I want to know if are possible:

Good news!  There are Blockly plugins available for each of these:

 
- Adding a search button to find a block you want easily

Assuming that you want to search within your Blockly workspace, you can use the Workspace search plugin.  If you meant searching within your toolbox, then you can use the Toolbox search plugin.

- Allow scrolling between categories
- - Like in Scratch, I want to make it so you don't have to click in the toolbox to go from category to category, but you can scroll to change categories


Hope this helps.

-Mark

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/41f98bdb-8a2c-48b9-bd04-c1ee24fc0ad5n%40googlegroups.com.

fu6...@gmail.com

unread,
Mar 31, 2024, 1:29:52 PM3/31/24
to Blockly
Hi, I wrote a sample project  about the continuous toolbox. Hope this helps.  

myContinuousToolbox

Best wishes.

fu...

bruh90...@gmail.com 在 2024年3月27日 星期三上午8:10:39 [UTC+8] 的信中寫道:

bruh 9000

unread,
Mar 31, 2024, 1:52:17 PM3/31/24
to Blockly
How were you able to make the toolbox not always open?

fu6...@gmail.com

unread,
Apr 1, 2024, 12:40:11 AM4/1/24
to Blockly
Hi, 
Please refer to this discussion.

fu6...

bruh90...@gmail.com 在 2024年4月1日 星期一凌晨1:52:17 [UTC+8] 的信中寫道:

Beka Westberg

unread,
Apr 1, 2024, 12:21:50 PM4/1/24
to Blockly
Hello,

You can also call `setAutoClose(false)` on the flyout.

Best wishes,
--Beka

bruh 9000

unread,
Apr 1, 2024, 1:13:28 PM4/1/24
to Blockly
Thank you! Do you know how to also make it so that the custom theme for the flyout is not added? I just want to have the toolbox scroll feature without any style or feature changes besides it.

Beka Westberg

unread,
Apr 2, 2024, 11:51:14 AM4/2/24
to blo...@googlegroups.com
Hello,

I haven't tried this, but you might be able to use the continuous flyout without using the toolbox:

```js
const workspace = Blockly.inject('blocklyDiv', {
  plugins: {
    // The below line has been commented out.
    // toolbox: ContinuousToolbox,
    flyoutsVerticalToolbox: ContinuousFlyout,
    metricsManager: ContinuousMetrics,
  },
  toolbox: toolboxCategories,
  // ... your other options here ...
});
```

Best wishes,
--Beka

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages