Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a 'preview tutorial' command #159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

add a 'preview tutorial' command #159

wants to merge 1 commit into from

Conversation

jwunderl
Copy link
Member

@jwunderl jwunderl commented Mar 30, 2023

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 that tutorialUri from the state in MakeCodeEditorSerializer but I didn't see an obvious way to do that; is it just adding another message in resources/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 :) )

@jwunderl jwunderl requested a review from riknoll March 30, 2023 19:29
Copy link
Member

@riknoll riknoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants