blockly-samples
blockly-samples copied to clipboard
Workspace-Search nested collapsed block
Check for duplicates
- [X] I have searched for similar issues before opening a new one.
Component
Workspace Search plugin
Description
https://github.com/google/blockly-samples/blob/dc79b14e4bc402e76cff960a4d72d4ac3a4365a5/plugins/workspace-search/src/workspace_search.ts#L461-L468
The filter function here only skips the block if surround parent is collapsed, however if the blocks are nested in multiple layers, and for example, the root parent block is collapsed, that inner-inner block is not skipped.
One nice approach (I believe) is search all blocks regardless if collapsed or not, then, when we highlight the block, we highlight the last ancestor block that is collapsed.
Use-case for this is we have modified the implementation, where we show # of found blocks and highlight the block Showing 4 of 2314 blocks found
, when navigating, the "hidden" blocks gets navigated to centerOnBlock(), it should only center the last ancestor collapsed block.
Previous implementation, if only 1 root block, and collapsed it, it will only result to 1 of 1 block found (if 1 level of nesting), otherwise it shows more beyond the first nested level, when highlighting it jumps to hidden blocks when navigating. Can be reproduced in demo link too
(hope this makes sense)
Reproduction steps
Basic demo in the playground
In the collapsed block theres more nested searchable block:
Then just try navigating it, highlighted is grey, then at some point everything is black coz the highlighted block is hidden.
Stack trace
No response
Screenshots
No response
This seems like a good approach! We'd welcome a PR if you'd like to make one.