Open
Conversation
riknoll
approved these changes
Mar 30, 2023
Member
riknoll
left a comment
There was a problem hiding this comment.
IMO we should match the behavior of the github scenario, since that's the primary one that people will be using this with (not share links). Also, I think the state has to be set inside the iframe, so doing a custom message for the serializer would be the way to go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 thattutorialUrifrom the state inMakeCodeEditorSerializerbut I didn't see an obvious way to do that; is it just adding another message inresources/editorMessagingsimilar 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 :) )