Fix playground toolbar link to point to repo

This commit is contained in:
Matt 'TK' Taylor
2026-04-01 14:10:30 +01:00
parent 4925c6014f
commit 0553848b66

View File

@@ -11,12 +11,12 @@
*/
export interface PlaygroundToolbarConfig {
/** When the playground was created (ISO string) */
createdAt: string;
/** TTL in seconds */
ttl: number;
/** Whether edit mode is currently active */
editMode: boolean;
/** When the playground was created (ISO string) */
createdAt: string;
/** TTL in seconds */
ttl: number;
/** Whether edit mode is currently active */
editMode: boolean;
}
const RE_AMP = /&/g;
@@ -25,9 +25,9 @@ const RE_LT = /</g;
const RE_GT = />/g;
export function renderPlaygroundToolbar(config: PlaygroundToolbarConfig): string {
const { createdAt, ttl, editMode } = config;
const { createdAt, ttl, editMode } = config;
return `
return `
<!-- EmDash Playground Toolbar -->
<div id="emdash-playground-toolbar" data-created-at="${escapeAttr(createdAt)}" data-ttl="${ttl}" data-edit-mode="${editMode}">
<div class="ec-pg-inner">
@@ -53,7 +53,7 @@ export function renderPlaygroundToolbar(config: PlaygroundToolbarConfig): string
<svg class="ec-pg-icon" id="ec-pg-reset-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>
</button>
<a class="ec-pg-btn ec-pg-btn--deploy" href="https://docs.emdashcms.com/getting-started" target="_blank" rel="noopener">
<a class="ec-pg-btn ec-pg-btn--deploy" href="https://github.com/emdash-cms/emdash" target="_blank" rel="noopener">
Deploy your own
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
</a>
@@ -333,9 +333,9 @@ export function renderPlaygroundToolbar(config: PlaygroundToolbarConfig): string
}
function escapeAttr(str: string): string {
return str
.replace(RE_AMP, "&amp;")
.replace(RE_QUOT, "&quot;")
.replace(RE_LT, "&lt;")
.replace(RE_GT, "&gt;");
return str
.replace(RE_AMP, "&amp;")
.replace(RE_QUOT, "&quot;")
.replace(RE_LT, "&lt;")
.replace(RE_GT, "&gt;");
}