Skip to content

Implement option to add only selected items to backpack#147

Open
LappiLappland wants to merge 2 commits into
mit-cml:mainfrom
LappiLappland:feat/better-backpack
Open

Implement option to add only selected items to backpack#147
LappiLappland wants to merge 2 commits into
mit-cml:mainfrom
LappiLappland:feat/better-backpack

Conversation

@LappiLappland

@LappiLappland LappiLappland commented May 24, 2026

Copy link
Copy Markdown

The basics

The details

Resolves

Fixes #137

Proposed Changes

Added backpackOnlySelected option (by default false). With option enabled:

  • Backpacks sequentially selected blocks as a single unit
  • Does not backpack "NEXT" items that are not in selection (does add INPUTs tho)
  • If selected blocks are not connected, then they are saved as separate units
  • Shows correct number of saved units in "Copy to backpack" context menu displayed text

Reason for Changes

This seems like a more reasonable behaviour for backpacking

Test Coverage

Added tests to verify behaviour when option is OFF and ON

I had to modify index.js file to expose window.multiselectPlugin

Documentation

I have updated README.md with option description

Additional Information

I think this could be very well true by default

I did not update dragging block onto backpack behaviour as it seems reasonable to save entire chain, since you do drag entire chain

Code cleanFlyoutInfo is taken from backpack plugin repository. We can call this as a method on backpack directly in Blockly 12. Unfortunately, it's not available in Blockly 11 version

@mjgallag mjgallag requested review from mjgallag May 24, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Save only selected blocks to backpack

1 participant