-
Notifications
You must be signed in to change notification settings - Fork 41
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
[Interactive code block] Add "theme mode" in the code editor #353
[Interactive code block] Add "theme mode" in the code editor #353
Conversation
Renable the editorMode setting Add a theme setting to editorMode
@adamziel, I could use your help with an error I'm experiencing with this PR. It's still very rudimentary, but when the
I think I'm calling activateTheme incorrectly, but I'm not sure how. |
@jonathanbossenger You're very close in this one! The error happens because
await activatePlugin(client, {
pluginPath,
});
await activateTheme(client, {
themeSlug,
}); you either have to pass await activateTheme(client, {
themeFolderName: themeSlug,
}); or rename the variable to const themeFolderName = 'demo-theme';
...
await activateTheme(client, {
themeFolderName,
}); |
Aaahhh that's what I missed, thanks @dawidurbanski |
Changed the mode selection to a RadioControl Updated the download functionality to support plugins and themes
@dawidurbanski or @adamziel I consider this PR ready to be reviewed. I did end up leaving both the writePluginFiles and writeThemeFiles components intact. While there is some duplication of code in the two components, I don't think we'll ever need another component that does the same thing, so I think it's an acceptable duplication. |
It looks and tests well, thank you @jonathanbossenger! The only rough edge I found was that there's no default theme that would populate the editor, and if I just switch to the theme mode then the theme gets auto activated and renders a blank page (or whatever my PHP script echos). It would be useful to either avoid auto-activation, populate the code editor with a working default theme, or explain why is there a white screen: It doesn't seem to be a blocker, but fixing this would make a great follow-up to this PR @jonathanbossenger. |
The CI job seems to be misconfigured for PRs coming from an external repository. I confirmed the lint passes cleanly on my computer. Let's get this in. |
I went ahead and initiated a new plugin release. Thank you for contributing @jonathanbossenger! |
Thanks, @adamziel! |
Thanks so much everyone!
@adamziel I did think about this during the process of my live stream, and I'm planning a follow up PR so that the first time you switch to theme mode, it loads a simple default set of theme files, but for now this can be done manually, and I'm ok with that 😁 |
What?
This PR attempts to add theme support to the code editor mode, so that users can set up a plugin or theme in the code editor mode.
Why?
I would like to be able to set up practical activities for learners on Learn.WordPress.org around both plugin and theme development, using the WordPress Playground block
How?
Testing Instructions
Fixes #351