Ignore insertion markers in getAllBlocks; add accessors for insertion markers#2243
Merged
rachel-fenichel merged 1 commit intoFeb 1, 2019
Merged
Ignore insertion markers in getAllBlocks; add accessors for insertion markers#2243rachel-fenichel merged 1 commit into
rachel-fenichel merged 1 commit into
Conversation
AnmAtAnm
reviewed
Jan 30, 2019
|
|
||
| // Insertion markers exist on the workspace for rendering reasons, but aren't | ||
| // "real" blocks from a developer perspective. | ||
| var filtered = blocks.filter(function(block) { |
Contributor
There was a problem hiding this comment.
Should these be filtered at the getDescendent() and getChildren() level? I imagine we don't want insertion markers returned via those methods, either.
Collaborator
Author
There was a problem hiding this comment.
Hm, maybe? I can't tell where the right place for this code is.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The basics
The details
Resolves
Fixes #2236
Proposed Changes
Stop counting insertion markers in the results of getAllBlocks. Add an accessor for getting the current live insertion markers from a gesture.
It also would have worked to have an optional parameter to getAllBlocks, but I decided to leave its signature alone and do something a little more complicated but only in internal code. This way we don't add yet another thing to the external API.
Reason for Changes
See #2236
Test Coverage
Tested in the max blocks demo with uncompressed blockly.
Additional Information
This might also apply to
workspace.getBlocksByType,getTopBlocks, etc. It's kind of unfortunate: there are good reasons for the blocks to be in the top blocks list, mostly related to behaving like perfectly normal blocks for connection and disconnection purposes, but in all other cases they're unwanted.