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:
cd15cde59b — Added 5 templates with inline content
c7913a8fc7 — Changed to URL-based fetching from GitHub
c46362c4c7 — Removed URL fetching (security fix), deleted template entries but kept HTML <option> elements ← bug introduced here
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
- Go to https://github.github.com/gh-aw/editor/index.html
- Select "Issue Triage" (or any template other than Hello World) from the dropdown
- Observe: dropdown visually changes but editor content stays on Hello World
- 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.
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
SAMPLESobject ineditor.jsfor security reasons (removing URL fetching), but left the corresponding<option>elements inindex.html.When
loadSample(key)is called for any key other thanhello-world,SAMPLES[key]returnsundefinedand the function returns early at the guard clause (if (!sample) return), so nothing happens.Timeline:
cd15cde59b— Added 5 templates with inline contentc7913a8fc7— Changed to URL-based fetching from GitHubc46362c4c7— Removed URL fetching (security fix), deleted template entries but kept HTML<option>elements ← bug introduced here2ae13e23dd— Removed CodeMirror; templates still missingProposed Fix
Restore the 4 missing template entries as inline content in the
SAMPLESobject indocs/public/editor/editor.js. The original inline content is available from commitcd15cde59b.Constraints:
index.html, event handlers, or deep-link logic — they already work correctly, they just need theSAMPLESdata populatedRepro
#hello-worldinstead of updatingExpected
Selecting any template from the dropdown should replace the editor content with that template's markdown and update the URL hash for deep linking.