mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
fix: Fix serialization of the lists_split block. (#8702)
This commit is contained in:
@@ -1046,22 +1046,19 @@ blocks['lists_split'] = {
|
||||
|
||||
/**
|
||||
* Returns the state of this block as a JSON serializable object.
|
||||
* This block does not need to serialize any specific state as it is already
|
||||
* encoded in the dropdown values, but must have an implementation to avoid
|
||||
* the backward compatible XML mutations being serialized.
|
||||
*
|
||||
* @returns The state of this block.
|
||||
*/
|
||||
saveExtraState: function (this: SplitBlock): null {
|
||||
return null;
|
||||
saveExtraState: function (this: SplitBlock): {mode: string} {
|
||||
return {'mode': this.getFieldValue('MODE')};
|
||||
},
|
||||
|
||||
/**
|
||||
* Applies the given state to this block.
|
||||
* No extra state is needed or expected as it is already encoded in the
|
||||
* dropdown values.
|
||||
*/
|
||||
loadExtraState: function (this: SplitBlock) {},
|
||||
loadExtraState: function (this: SplitBlock, state: {mode: string}) {
|
||||
this.updateType_(state['mode']);
|
||||
},
|
||||
};
|
||||
|
||||
// Register provided blocks.
|
||||
|
||||
Reference in New Issue
Block a user