jdevalk / playground-embedder

Embeds the WordPress playground through a shortcode
11 stars 3 forks source link

Add a Gutenberg block to embed the playground #5

Open jdevalk opened 1 year ago

jdevalk commented 1 year ago

Specially for Jon Bossenger.

hacktoberfest

jonathanbossenger commented 1 year ago

This one certainly has me intrigued...

My first question is, would you want the entire instance of the playground to be visible/active/working in the editor? I assume the primary goal is to render it on the front end of a site, so having a working instance in the editor might not be a top priority.

The reason I ask is that a) I'm not yet sure if this is possible, and b) even if it is we might end up with what I jokingly like to call "iframe-ception" which may or may not work as expected. I'm still researching this to find out, but wanted to understand the requirement first.

What we could do as a first MVP is create a custom block that simply loads a screenshot of the playground as an image in the editor, and then use dynamic block rendering to let the PHP handle the front end. That would be a quick win solution, which we could then iterate on.

jonathanbossenger commented 1 year ago

Update, it turns out it might be easier than I thought, will report back once I have a working POC, either later this week, or something next week.

@jdevalk in the meantime, would you mind adding the label hacktoberfest to this issue? (you may need to add it to be able to apply it) and assigning the ticket to me.

Thanks.

jdevalk commented 1 year ago

@jonathanbossenger adding this to the shortcode in the next hour or so, but you might want to know about it too:

https://github.com/WordPress/wordpress-playground/issues/533

dparker1005 commented 1 year ago

Hi everyone! I've actually been working on an Embed WP Playground block plugin in another repo and you are more than welcome to take a look at its code if it would be helpful! https://github.com/strangerstudios/embed-wp-playground

I had submitted that plugin to the WordPress.org repo before I knew that this Playground Embedder plugin existed. Though I am more than happy for the block code to be included in this plugin as well, it seems like it would be in the best interest of the WP community to have a WP Playground block in the Block Directory. If I understand correctly, having other functionality in a plugin (such as a shortcode) would disqualify a plugin from being included in the Block Directory, which is the only reason that I plan to keep Embed WP Playground in the plugin review queue.

But please feel free to take a look at the Embed WP Playground code and use whatever you find useful!