Closed jxns closed 1 year ago
@jxns can you share your extension?
@abchatra of course, my extension is this one: pxt-RB-JoyPi-Advanced
It's not documented well on that page, but there's a package field in the render message where you can pass in packages you want to include; the string should use the same format as the package snippet in 'normal' docs: https://makecode.com/writing-docs/snippets#package; e.g. in this case the render message would look something like:
f.contentWindow.postMessage({
type: "renderblocks",
id: pre.id,
code: pre.innerText,
options: {
package: "pxt-rb-joypi-advanced=github:joy-it/pxt-RB-JoyPi-Advanced"
}
}, "https://makecode.microbit.org/");
I have to double check on our editor interface whether package can handle multiple dependencies (if they're e.g. split by new lines, another delimitter, or pass an array or something) but should work fine for this scenario?
Adding the package in the options tag worked perfectly. Thank you very much!
@ganicke can we document this?
I implemented the blocks embed method in a software I am developing. The rendering works great but the renderer can not translate blocks of my extension (the extension is already released and added to the makecode repository). Is there any way I can use extensions in combination with blocks embed or does this only work with internal blocks?