Hello Masaru,
I took a quick look at your code and your error is about the workspace variable used in the toJSON definition L55 in custom_generator.js, however this mistake is on us (the codelab needs updating).
This codelab was written before some significant changes were made to the advanced playground and the workspace variable used to be more easily accessible in the embedded JS code on advance_playground.html (and I believe the toJSON method was meant to also be put there). The taChange function was also removed.
I am going to file an issue shortly for fixing the codelab.
To fix this issue in the meanwhile:
- replace workspace with Blockly.getMainWorkspace()
- remove taChange() L58 - I think this should be OK
Hopefully the rest of the codelab is fine as this issue is specific to the UI on the advanced playground and not the generator implementation.
Let us know if you encounter any other issues. I'll reply to this thread with the issue I file for updating the codelab.
~ Monica