This commit is contained in:
Matt Kane
2026-04-01 15:25:41 +01:00
parent 9db4c2cba2
commit ca398cc3f8
2 changed files with 16 additions and 16 deletions

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">
@@ -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;");
}

View File

@@ -13,8 +13,8 @@
{
"binding": "DB",
"database_name": "emdash-marketplace",
"database_id": "e07c5b3b-c3e0-4cec-be3b-1ae0bb87da35"
}
"database_id": "e07c5b3b-c3e0-4cec-be3b-1ae0bb87da35",
},
],
"r2_buckets": [
{
@@ -35,4 +35,4 @@
"class_name": "AuditWorkflow",
},
],
}
}