WordPress / playground-tools

GNU General Public License v2.0
127 stars 38 forks source link

Playground block: Support remote files #282

Closed adamziel closed 1 month ago

adamziel commented 1 month ago

What?

Enables providing remote URLs as filenames in the Playground Block's code editor:

CleanShot 2024-05-22 at 18 19 40@2x

With this change, you can write an interactive WordPress tutorial using source code hosted on GitHub. It's easier to manage, preview, clone, and fork. While the remote URL is a source of truth for the block, it still stores a copy of the code in block attributes.

Testing Instructions

  1. Insert the Playground block.
  2. Create a new file, paste this URL as its name: https://raw.githubusercontent.com/WordPress/block-development-examples/trunk/plugins/data-basics-59c8f8/_playground/blueprint.json
  3. Confirm a new file was created with the "link" icon at the top.
  4. Try changing its content, saving the post, and refreshing the page. It should have no effect.
  5. Confirm regular files still work as they used to.

cc @juanmaguitar @ryanwelcher