Import block library from a .JS file instead of .xml in blockly developper tools

430 views
Skip to first unread message

Nicolas Mothiron

unread,
Jul 27, 2018, 9:38:12 AM7/27/18
to Blockly
Hi team,

I was using the Blockly Developper Tools and exporting my blocks into JS files. I did a wrong manipulation and tried to reload them but it seemed the only supported format file for import is .xml, but I haven't any save/file on this format.

Is it a way to load my JS blocks into the BDT ?
Knowing that I don't have them loaded so I can't re export them into xml.

Regards,

Rachel Fenichel

unread,
Jul 27, 2018, 4:55:58 PM7/27/18
to Blockly
If your blocks are defined with JSON you can set the "Block Definition" dropdown to "Manual JSON..." and paste your block definition there, at which point you should be able to save the block.

Rachel

Nicolas Mothiron

unread,
Jul 27, 2018, 5:06:22 PM7/27/18
to blo...@googlegroups.com
And with JS ? 

--
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.
For more options, visit https://groups.google.com/d/optout.

Rachel Fenichel

unread,
Jul 27, 2018, 5:23:43 PM7/27/18
to Blockly
Not currently doable.

How did you export them so that you have them only as js and not as XML, but lost the definitions?  Maybe we can work back from there.

Rachel

Nicolas Mothiron

unread,
Jul 27, 2018, 5:31:25 PM7/27/18
to blo...@googlegroups.com
Using the export tab, I downloaded block JS definition and code generator script, also JS

I though it was enough to import, after some wrong manipulation i've clear my library so now they aren't in BDT anymore
I'm looking for a way to load them back :/

Rachel Fenichel

unread,
Jul 27, 2018, 5:37:40 PM7/27/18
to Blockly
I see.  We don't have a good way for you to do that right now--the blocks are stored internally as the structure that was used to build them, not the final JavaScript block definition.

Nicolas Mothiron

unread,
Jul 27, 2018, 6:33:17 PM7/27/18
to blo...@googlegroups.com
So the only option is to create them again :/
I guess if I put all of them unconnected in  workspace and save them into xml with workspaceToXml or something, it will save only their state and it will tell me that the blocks are undeclared or an  equivalent error :/

Thanks again for your quick answer ! 
Reply all
Reply to author
Forward
0 new messages