fix(registry): show variable values as text in claude-exchange and slack-notification-ad (#8700)

claude-exchange set its editable strings through the same helper that writes
its own icons and layout, and slack-notification-ad built the payoff logo tag
by joining strings. A value holding tags or quotes became elements and
attributes instead of showing as typed. Editable strings now go through
textContent, and the payoff logo is an img bound with data-var-src, so it takes
the same addresses as every other image variable.

slack-notification-ad no longer writes markup, so its entry leaves the
markup-write baseline.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
James Russo
2026-11-24 11:40:26 +00:00
committed by GitHub
co-authored by Claude Fable 5.2
parent 37e4d4b75a
commit 93f7f69de9
3 changed files with 37 additions and 24 deletions
+16 -12
View File
@@ -920,13 +920,19 @@
/* ============================================================== build */
const screen = document.getElementById("cle-screen");
// `html` is this file's own markup (icons, layout), never a variable: editable
// strings go through `text`, which sets textContent and so cannot become markup.
const el = (cls, html, tag) => {
const n = document.createElement(tag || "div");
if (cls) n.className = cls;
// Editable strings reach innerHTML; the template delivery gate rejects angle brackets.
if (html != null) n.innerHTML = html;
return n;
};
const text = (cls, value, tag) => {
const n = el(cls, null, tag);
n.textContent = value;
return n;
};
// --- status bar
const sb = el("statusbar");
@@ -968,12 +974,11 @@
// tool rows: thinking -> lead sentence -> search -> collapsed "2 steps"
const toolWrap = el("tools");
toolWrap.style.paddingTop = "0px";
const mkTool = (ico, label) =>
el(
"tool-row",
`<div class="tool-ico">${ico}</div><div>${label}</div>` +
`<div class="chev">${ICO.chevR}</div>`,
);
const mkTool = (ico, label) => {
const row = el("tool-row");
row.append(el("tool-ico", ico), text(null, label), el("chev", ICO.chevR));
return row;
};
// wrap: the shell animates, the child carries the gap
const wrap = (inner, pad) => {
const o = el("abox");
@@ -993,7 +998,7 @@
leadInner.style.paddingTop = "27.1px";
const leadWords = [];
CONFIG.lead.split(" ").forEach((w, i, arr) => {
const s = el("w", w + (i < arr.length - 1 ? " " : ""), "span");
const s = text("w", w + (i < arr.length - 1 ? " " : ""), "span");
leadInner.appendChild(s);
leadWords.push(s);
});
@@ -1041,14 +1046,13 @@
word = word.replace("**", "");
}
if (word.indexOf("{") === 0) {
const chip = el("cite w", word.replace(/[{}]/g, ""), "span");
const chip = text("cite w", word.replace(/[{}]/g, ""), "span");
inner.appendChild(chip);
words.push(chip);
return;
}
const s = el("w", word, "span");
const s = text("w", word, "span");
if (bold) s.style.fontWeight = "700";
s.textContent = word;
if (close) bold = false;
inner.appendChild(s);
words.push(s);
@@ -1135,7 +1139,7 @@
};
mkCursor();
CONFIG.prompt.split("").forEach((c) => {
const sp = el("ch", c === " " ? "&nbsp;" : c, "span");
const sp = text("ch", c === " " ? "\u00a0" : c, "span");
typedEl.appendChild(sp);
chEls.push(sp);
mkCursor();
@@ -510,7 +510,8 @@
{
title: content("payoffTitle", "HeyGen"),
text: content("payoffText", "Heard you needed some videos?"),
icon: content("payoffIcon", "assets/img/heygen-mark.svg"),
icon: "assets/img/heygen-mark.svg",
iconVariable: "payoffIcon",
},
],
};
@@ -535,20 +536,29 @@
/* ---------------- build cards ---------------- */
var stackEl = document.getElementById("sna-stack");
function node(tag, cls, text) {
var n = document.createElement(tag);
n.className = cls;
if (text != null) n.textContent = text;
return n;
}
CONFIG.notifs.forEach(function (n, i) {
var card = document.createElement("div");
card.className = "ncard";
card.id = "sna-n" + i;
card.setAttribute("data-layout-allow-overlap", ""); // iOS stack: front card occludes the cards tucked behind it
card.setAttribute("data-layout-allow-occlusion", "");
card.innerHTML =
'<div class="nicon"><img src="' +
(n.icon || CONFIG.icon) +
'" alt=""></div>' +
'<div class="nbody"><div class="nrow"><span class="ntitle"></span><span class="ntime">now</span></div>' +
'<div class="ntext"></div></div>';
card.querySelector(".ntitle").textContent = n.title;
card.querySelector(".ntext").textContent = n.text;
var img = document.createElement("img");
img.alt = "";
img.setAttribute("src", n.icon || CONFIG.icon);
if (n.iconVariable) img.setAttribute("data-var-src", n.iconVariable);
var row = node("div", "nrow");
row.append(node("span", "ntitle", n.title), node("span", "ntime", "now"));
var body = node("div", "nbody");
body.append(row, node("div", "ntext", n.text));
var icon = node("div", "nicon");
icon.appendChild(img);
card.append(icon, body);
stackEl.appendChild(card);
});
var cards = CONFIG.notifs.map(function (_, i) {
+2 -3
View File
@@ -10,8 +10,8 @@ import { fileURLToPath } from "node:url";
* variables must set text with `textContent` or build nodes instead, and the files below may only lose writes.
* Lower a count, or delete the entry, when a file is converted.
*
* chatgpt-exchange's remaining writes are its own icons and layout; its variable text already goes through
* `textContent`.
* The remaining writes in chatgpt-exchange and claude-exchange are their own icons and layout; their variable
* text already goes through `textContent`.
*/
export const MARKUP_WRITE_BASELINE = new Map([
["registry/blocks/ai-chat-reveal/ai-chat-reveal.html", 2],
@@ -20,7 +20,6 @@ export const MARKUP_WRITE_BASELINE = new Map([
["registry/blocks/exploded-stack/exploded-stack.html", 1],
["registry/blocks/message-thread-reveal/message-thread-reveal.html", 1],
["registry/blocks/share-sheet-carousel/share-sheet-carousel.html", 1],
["registry/blocks/slack-notification-ad/slack-notification-ad.html", 1],
["registry/blocks/wireframe-portal-title/wireframe-portal-title.html", 1],
["registry/components/beat-timeline/beat-timeline.html", 1],
["registry/components/chat-message/chat-message.html", 2],