blockly-samples icon indicating copy to clipboard operation
blockly-samples copied to clipboard

Multiple workspaces with toolbox-search

Open savakarrohan opened this issue 1 year ago • 1 comments

Check for duplicates

  • [X] I have searched for similar issues before opening a new one.

Component

"@blockly/toolbox-search" plugin doesn't appear to have support for multiple workspaces.

Description

I have a jupyterlab extension which Injects blockly to every editor that is open, (through a host node). While multiple workspaces render correctly without using the toolbox-search. Once the toolbox-search is added, the blockly rendering is faulty.

I have added a git repository for a similar example at : (https://github.com/savakarrohan/bookish-octo-robot) Pictures for both mentioned environments are below.

Do direct me towards appropriate part of code, and I am willing to open up a pull-request!

Note: On a side note, the readme for toolbox-search on NPM is not showing.

Reproduction steps

  1. Create new package using @blockly/create-package
  2. Add a second blocklydiv2 to html
  3. Inject workspace with appropriate settings as mentioned in @blockly/toolbox-search

Stack trace

bundle.js:607  Uncaught Error: Shortcut named "startSearch" already exists.
    at ShortcutRegistry$$module$build$src$core$shortcut_registry.register (blockly_compressed.js:1219:1)
    at r.registerShortcut (index.js:2:1)
    at new r (index.js:2:1)
    at Toolbox$$module$build$src$core$toolbox$toolbox.createToolboxItem_ (blockly_compressed.js:1613:1)
    at Toolbox$$module$build$src$core$toolbox$toolbox.renderContents_ (blockly_compressed.js:1612:1)
    at Toolbox$$module$build$src$core$toolbox$toolbox.render (blockly_compressed.js:1611:1)
    at Toolbox$$module$build$src$core$toolbox$toolbox.init (blockly_compressed.js:1605:1)
    at init$$module$build$src$core$inject (blockly_compressed.js:430:1)
    at Object.inject$$module$build$src$core$inject [as inject] (blockly_compressed.js:424:1)
    at eval (index.js:36:1)

Screenshots

image Error, with 2 workspaces on create-package image Dual workspace working fine image Workspace with toolbar not working on `jupyterlab` environment image Multiple workspace with toolbar working without 'toolbox-search' on `juptyerlab` environment

savakarrohan avatar Dec 20 '23 04:12 savakarrohan

Hello, thank you for reporting this issue. If you'd like to fix it, you can look for the code in this repository under the plugins/toolbox-search directory. It might be as easy as checking if the shortcut is registered before trying to register it again. There may be additional work needed to make this plugin compatible with multiple workspaces. You can find more information about contributing to plugins in our documentation. If you don't want to take this on, we'll leave the bug open but are unable to prioritize it in the near future. Thanks!

maribethb avatar Jan 03 '24 22:01 maribethb