Skip to content

feat(playground): auto-load the editor in the WordPress Playground#51

Merged
erseco merged 1 commit into
mainfrom
feat/playground-editor-unzip
Jun 7, 2026
Merged

feat(playground): auto-load the editor in the WordPress Playground#51
erseco merged 1 commit into
mainfrom
feat/playground-editor-unzip

Conversation

@erseco

@erseco erseco commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

What

Auto-load the embedded eXeLearning editor in the WordPress Playground so it boots with a working editor instead of requiring the manual Settings → eXeLearning → Download & Install Editor button.

Two blueprint steps after installPlugin:

  1. writeFile fetches the shared editor release asset through the github-proxy (CORS) over the fast JS transport into /tmp/exe-editor.zip.
  2. runPHP locates the installed plugin dir and extracts the zip into its dist/:
$dirs = glob(WP_PLUGIN_DIR . '/wp-exelearning*', GLOB_ONLYDIR);
$zip = new ZipArchive;
$zip->open('/tmp/exe-editor.zip');
$zip->extractTo($dirs[0] . '/dist');   // asset wraps in static/ -> dist/static/

Why

The static editor is byte-identical across all eXeLearning plugins and is already published once at exelearning/exelearning. Fetching that shared artifact at blueprint time is the WordPress-Playground-idiomatic pattern (resource url + extract), and it keeps the plugin zip lean.

Notes:

  • The plugin is installed from the branch source archive, so its directory carries a branch suffix (wp-exelearning-<branch>); the extract step finds it with a glob, so it works on any PR.
  • ZipArchive is already used by the fixtures step, so no new runtime dependency.
  • The asset's static/ wrapper means extracting into dist yields the dist/static/ layout the plugin loads from (EXELEARNING_PLUGIN_DIR . 'dist/static/index.html'). Pinned to v4.0.0 to match .editor-version.
  • StaticEditorInstaller is kept for production/offline installs; only the playground changes.

Part of a fleet-wide change unifying how the editor loads in every eXeLearning playground.

Test

Open the Playground for this branch and confirm the editor loads on boot (no manual step) and a page renders.

Add a writeFile + runPHP pair to the blueprint that fetches the shared eXeLearning editor release asset (github-proxy, CORS) over the fast JS transport and extracts it into the installed plugin's dist/static, so the playground boots with a working editor instead of requiring the manual "Download & Install Editor" button.

The plugin is installed from the branch source archive, so its directory carries a branch suffix (wp-exelearning-<branch>); the extract step locates it with a glob and unzips with ZipArchive (already used by the fixtures step). The release asset wraps everything in a 'static/' folder, so extracting into 'dist' yields the dist/static/ layout the plugin loads from (EXELEARNING_PLUGIN_DIR . 'dist/static/index.html'). Pinned to v4.0.0 to match .editor-version.

StaticEditorInstaller is kept for production/offline installs; the PR-preview note is updated accordingly.
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Test in WordPress Playground

Test the plugin with the code from this branch:

Preview in WordPress Playground

ℹ️ The eXeLearning editor is fetched from the shared release and unpacked into the plugin when the playground boots, so the first load may take a few extra seconds. ELP upload, shortcode, Gutenberg block and preview work normally.

@erseco erseco merged commit 1679303 into main Jun 7, 2026
4 checks passed
@erseco erseco deleted the feat/playground-editor-unzip branch June 7, 2026 12:54
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.

1 participant