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 wp-cli and code editor examples to the demos page #965

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 45 additions & 5 deletions packages/playground/website/demos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,59 @@ <h2>WordPress Playground demos</h2>
</p>
<ul>
<li>
<a href="terminal.html">wp-cli</a>
<a href="terminal.html" target="_blank">wp-cli</a>
</li>
<li>
<a href="sync.html">Synchronization between two Playgrounds</a>
<a id="code-editor" target="_blank"
>Code editor (as a Gutenberg block)</a
>
</li>
<script>
const codeEditorBlueprint = {
landingPage: '/wp-admin/post.php?post=1&action=edit',
steps: [
{
step: 'login',
},
{
step: 'installPlugin',
pluginZipFile: {
resource: 'wordpress.org/plugins',
slug: 'interactive-code-block',
},
},
{
step: 'writeFile',
path: '/wordpress/post.txt',
data: '<!-- wp:wordpress-playground/playground {"codeEditor":true,"files":[{"name":"index.php","contents":"<?php\\\\n/**\\\\n * Plugin Name: A WordPress plugin\\\\n */\\\\nadd_action(\'init\', function() {\\\\n update_option(\'blogname\', \'This is a Playground demo!\');\\\\n});"}]} /-->',
},
{
step: 'runPHP',
code: "<?php require '/wordpress/wp-load.php'; kses_remove_filters(); wp_update_post(['ID'=>1,'post_title' => 'Playground Plugin Editor', 'post_content'=>file_get_contents('/wordpress/post.txt')]);",
},
],
};
document.getElementById('code-editor').href = `../#${JSON.stringify(
codeEditorBlueprint
)}`;
</script>
<li>
<a href="time-traveling.html">Time Travel</a>
<a href="sync.html" target="_blank"
>Synchronization between two Playgrounds</a
>
</li>
<li>
<a href="../wordpress.html">WordPress Pull Request Previewer</a>
<a href="time-traveling.html" target="_blank">Time Travel</a>
</li>
<li>
<a href="../gutenberg.html">Gutenberg Pull Request Previewer</a>
<a href="../wordpress.html" target="_blank"
>WordPress Pull Request Previewer</a
>
</li>
<li>
<a href="../gutenberg.html" target="_blank"
>Gutenberg Pull Request Previewer</a
>
</li>
</ul>
</body>
Loading