From f4732e3df7fdf1ed2f3847b0fff45e43a4fcce66 Mon Sep 17 00:00:00 2001 From: tianma-if Date: Sun, 18 Oct 2026 21:12:24 +0800 Subject: [PATCH] fix: remove generated avatar from note image signatures --- packages/shared/src/note-image-card.test.mjs | 14 +++++++++++++- packages/shared/src/note-image-card.ts | 10 +--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/shared/src/note-image-card.test.mjs b/packages/shared/src/note-image-card.test.mjs index 633f060f..b0322f39 100644 --- a/packages/shared/src/note-image-card.test.mjs +++ b/packages/shared/src/note-image-card.test.mjs @@ -12,6 +12,17 @@ import { pl } from "./i18n/pl"; import { NOTE_IMAGE_FONT_SUBSETS } from "./note-image-font-manifest"; describe("note image templates", () => { + test("author signatures show only the name without a generated avatar in every template", () => { + for (const theme of NOTE_IMAGE_THEME_OPTIONS) { + const markup = buildNoteImageCardMarkup({ theme, title: "Note", bodyHtml: "

Text

", author: "天马", showAuthor: true }); + const { document } = parseHTML(markup); + const signature = document.querySelector(".edgeever-footer-author"); + expect(signature?.textContent).toBe("天马"); + expect(signature?.children.length).toBe(1); + expect(document.querySelector(".edgeever-card-avatar")).toBeNull(); + } + }); + test("each template references the font family registered by its bundled assets", () => { for (const theme of NOTE_IMAGE_THEME_OPTIONS) { const preset = NOTE_IMAGE_TEMPLATE_TYPOGRAPHY[theme]; @@ -118,7 +129,8 @@ describe("note image templates", () => { } } const signed = buildNoteImageCardMarkup({ theme: "bento", title: "Note", bodyHtml: "", author: "天马", showAuthor: true, showBranding: false }); - expect(signed).toContain('天'); + expect(signed).not.toContain('class="edgeever-card-avatar"'); + expect(signed).toContain('天马'); expect(signed).toContain('天马'); expect(signed).not.toContain('class="edgeever-brand-badge"'); }); diff --git a/packages/shared/src/note-image-card.ts b/packages/shared/src/note-image-card.ts index 101b4ad3..fea0d951 100644 --- a/packages/shared/src/note-image-card.ts +++ b/packages/shared/src/note-image-card.ts @@ -207,9 +207,6 @@ export const buildNoteImageCardMarkup = ({ const hasTitle = showTitle && Boolean(title.trim()); const hasAuthor = showAuthor && Boolean(author.trim()); const authorName = hasAuthor ? escapeCardHtml(author.trim()) : ""; - const initial = escapeCardHtml(Array.from(author.trim())[0]?.toUpperCase() || ""); - // Keep identity with the signature, away from the note's reading entry point. - const avatar = hasAuthor ? `` : ""; const meta: string[] = []; const dateHtml = showUpdatedAt && updatedAt.trim() ? `
${escapeCardHtml(updatedAt)}
` : ""; if (showNotebook && notebook.trim()) meta.push(`${escapeCardHtml(notebook)}`); @@ -237,7 +234,7 @@ export const buildNoteImageCardMarkup = ({ `; const footer = hasAuthor || showBranding || meta.length ? `` : ""; // Only a standalone short paragraph gets the large quotation treatment. @@ -297,11 +294,6 @@ export const generateCardCss = ({ theme = "gradient", fontStyle = "auto", fontSi min-width: 0; overflow: hidden; } .edgeever-card-header:empty { display: none; } -.edgeever-card-avatar { - display: flex; align-items: center; justify-content: center; width: ${px(24)}; height: ${px(24)}; - flex-shrink: 0; border-radius: 50%; background: ${cfg.isDark ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.04)"}; - color: var(--ee-meta); font: 500 ${px(12)} / 1 ${NOTE_IMAGE_FONT_FAMILIES.sans}; -} .edgeever-card-date, .edgeever-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: ${px(4)} ${px(12)};