Skip to content

Playground editor template dropdown is broken — only Hello World works #25526

Description

@Mossaka

Bug

The template dropdown on the playground editor lists 5 options but only "Hello World" works. Selecting any other template (Issue Triage, CI Doctor, Contribution Guidelines Checker, Daily Repo Status) does nothing — the editor content and URL hash remain unchanged.

Root Cause

Commit c46362c ("remove fetch(url) from editor.js - only allow copy-paste of markdown") removed the 4 non-hello-world template entries from the SAMPLES object in editor.js for security reasons (removing URL fetching), but left the corresponding <option> elements in index.html.

When loadSample(key) is called for any key other than hello-world, SAMPLES[key] returns undefined and the function returns early at the guard clause (if (!sample) return), so nothing happens.

Timeline:

  1. cd15cde59b — Added 5 templates with inline content
  2. c7913a8fc7 — Changed to URL-based fetching from GitHub
  3. c46362c4c7 — Removed URL fetching (security fix), deleted template entries but kept HTML <option> elements ← bug introduced here
  4. 2ae13e23dd — Removed CodeMirror; templates still missing

Proposed Fix

Restore the 4 missing template entries as inline content in the SAMPLES object in docs/public/editor/editor.js. The original inline content is available from commit cd15cde59b.

Constraints:

  • No new dependencies — the editor is now dependency-free (no CodeMirror) and must stay that way
  • No URL fetching — content must be inline in the JS file
  • No changes needed to index.html, event handlers, or deep-link logic — they already work correctly, they just need the SAMPLES data populated

Repro

  1. Go to https://github.github.com/gh-aw/editor/index.html
  2. Select "Issue Triage" (or any template other than Hello World) from the dropdown
  3. Observe: dropdown visually changes but editor content stays on Hello World
  4. Observe: URL hash stays #hello-world instead of updating

Expected

Selecting any template from the dropdown should replace the editor content with that template's markdown and update the URL hash for deep linking.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions