Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a 'preview tutorial in blocks editor' command to preview tutorials similar to https://makecode.com/tutorial-tool
Do we know if there's any way to set state for the webview directly from
src/web/editor.ts
? Ideally we should be persisting / reloading thattutorialUri
from the state inMakeCodeEditorSerializer
but I didn't see an obvious way to do that; is it just adding another message inresources/editorMessaging
similar to the "open" one that sends in the tutorial uri and then doesn't propagate it to the editor frame?I poked around for a minute to see about making it load in the current project as an extension, but it appeared to get dropped at some point in the tutorial load process and I didn't want to go down that rabbit hole for now. Here's the very quick branch as a ref https://github.com/microsoft/pxt/tree/allowLoadingHeaderForTutorialPreview. FWIW it looks like the github integration feature is broken as well microsoft/pxt-microbit#4777.
Maybe more importantly, it's a weird inconsistency we should probably think on for pxt tutorials -- if you load a tutorial from a github project it auto adds itself as a dependency (without declaring it in package.json), but it doesn't do the same thing if you load from a share link -- I've seen a few times where a tutorial author had a few lines in main.ts and were confused by how their project was misbehaving. I'd probably lean towards share link behavior of no magic imports personally (which this handles :) )