Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace block (TBD, perhaps replace or place?): use the marker workflow to place a new block at this location. #173

Closed
Tracked by #132
rachel-fenichel opened this issue Jan 21, 2025 · 1 comment
Assignees

Comments

@rachel-fenichel
Copy link
Contributor

rachel-fenichel commented Jan 21, 2025

Preconditions

  • NavigationController.canCurrentlyEdit(workspace) is true
  • Cursor is on a block node
    • Block can be either a stack block or a reporter. Can it be a shadow block?
  • The block is editable, deletable, and movable

Callback

  • Save the cursor location as originalBlockLocation
  • Set a flag in the navigation state: shouldReplace = true
  • Set the cursor location to the block's previous connection (for a stack block)
    • Where does the cursor location get set for a reporter block?
  • Open the toolbox

Related work

The insertFromFlyout and insertFromToolbox actions will need to be updated to check for shouldReplace.
If shouldReplace is true, those actions should:

  • Move the originalBlock to the workspace. This block can be found by inspecting the saved originalBlockLocation
  • Connect the flyout/toolbox block at the cursor location
  • Set shouldReplace to false
  • Clear originalBlockLocation

If the user hits Escape from the flyout or toolbox:

  • Set shouldReplace to false
  • Clear originalBlockLocation
@rachel-fenichel
Copy link
Contributor Author

Closing because all of the discussion about insert vs replace is on #132, and the details of correct replacement, splicing, and bumping are all handled by core Blockly's connect method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant