ERROR
Cannot read properties of undefined (reading 'workspaces')
TypeError: Cannot read properties of undefined (reading 'workspaces')
at saveButton (http://localhost:8081/:17:49)
at HTMLButtonElement.onclick (http://localhost:8081/:13:56)
Using the above reference, I addedfunction saveButton() {const state = Blockly.serialization.workspaces.save(myWorkspace);}as a script for a button and I get the following error when it is pressed. I want to be able to save the text to a variable (and download it for the user)
ERROR
Cannot read properties of undefined (reading 'workspaces')
TypeError: Cannot read properties of undefined (reading 'workspaces')
at saveButton (http://localhost:8081/:17:49)
at HTMLButtonElement.onclick (http://localhost:8081/:13:56)
I don't have workspace saved in a var called myWorkspaceI imported it with `npx @blockly/create-package app hello-world`
const ws = Blockly.inject(blocklyDiv, {toolbox});
const state = Blockly.serialization.workspaces.save(myWorkspace);
Cannot read properties of undefined (reading 'toLowerCase')
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
at $.Names$$module$build$src$core$names.equals (webpack-internal:///./node_modules/blockly/blockly_compressed.js:728:395)
at VariableMap$$module$build$src$core$variable_map.getVariable (webpack-internal:///./node_modules/blockly/blockly_compressed.js:1040:360)
at VariableMap$$module$build$src$core$variable_map.createVariable (webpack-internal:///./node_modules/blockly/blockly_compressed.js:1036:378)
at WorkspaceSvg$$module$build$src$core$workspace_svg.createVariable (webpack-internal:///./node_modules/blockly/blockly_compressed.js:1048:464)
at WorkspaceSvg$$module$build$src$core$workspace_svg.createVariable (webpack-internal:///./node_modules/blockly/blockly_compressed.js:1088:380)
at VariableSerializer$$module$build$src$core$serialization$variables.load (webpack-internal:///./node_modules/blockly/blockly_compressed.js:1237:578)
at reader.onload (webpack-internal:///./src/index.js:103:20)
--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/c91da113-9d02-4f68-a3f2-6cc276ffcd5fn%40googlegroups.com.