fix: update content highlight when undoing the deletion of blocks. #2487
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
I couldn't replicate the bug reported at the top of #2175 (where reloading the page does not highlight the content) when testing locally (admittedly I was building against Blockly v11.2.0, and I can replicate it at the currently published version of https://google.github.io/blockly-samples/plugins/content-highlight/test/index.html )
However, I could replicate the bug reported in the comment #2175 (comment) and this PR fixes that.
Fixes
Proposed Changes
Adds BLOCK_CREATE to the list of events that can trigger updating the content highlight.
Reason for Changes
BLOCK_DELETE was already in the list, which successfully updates the content-highlight when deleting a block. However, undoing the deletion results in a BLOCK_CREATE event being fired. (I presume other methods of adding blocks to the workspace also result in other events that are already being listened to, like BLOCK_MOVE.)
Test Coverage
I tested manually.
Documentation
N/A
Additional Information
N/A