Update to Blockly 12 with JSON serialization support#86
Open
B-head wants to merge 3 commits intomit-cml:mainfrom
Open
Update to Blockly 12 with JSON serialization support#86B-head wants to merge 3 commits intomit-cml:mainfrom
B-head wants to merge 3 commits intomit-cml:mainfrom
Conversation
Update blockly and @blockly/dev-tools, @blockly/dev-scripts to Blockly 12 compatible versions. Set peerDependencies to ^12.0.0 (verified working with 12.0.0). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Blockly 12 requires a workspace argument for Blockly.Variables.generateUniqueName(). Fall back to the main workspace if the source block is not yet attached. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Blockly 12's flyout generates JSON extraState for procedure caller blocks, but the plugin only had XML-based mutationToDom/domToMutation. This caused a crash when opening the Functions toolbox category because loadExtraState fell back to textToDom with a JSON object. Add saveExtraState/loadExtraState to all blocks with mutations: - procedures_callnoreturn / procedures_callreturn - procedures_defnoreturn / procedures_defreturn - local_declaration_statement / local_declaration_expression Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
peerDependencies: ^12.0.0,devDependencies: ^12.5.1)generateUniqueNamecall that requires a workspace argument in Blockly 12saveExtraState/loadExtraStateto all blocks with mutations, fixing a crash when opening the Functions toolbox categoryContext
This PR builds on the work started in #68 by @mjgallag and incorporates the fix suggested by @TannerGabriel in their review comment.
Blockly 12's flyout system generates JSON
extraStatefor procedure caller blocks. WithoutloadExtraState, the deserialization falls back totextToDom()with a JSON object, causingDOMParser was unable to parse: [object Object].This PR adds
saveExtraState/loadExtraStateto all six block types with mutations, while preserving the existingmutationToDom/domToMutationfor XML backward compatibility.Note on the
local_declaration_statementmutator bugThe rendering error when adding a second variable via the mutator (reported in #68) could not be reproduced with Blockly 12.0.0 or 12.5.1.
Test plan
saveExtraState/loadExtraState)