fix: remove generated avatar from note image signatures
This commit is contained in:
1 parent
d885161b3e
commit
f4732e3df7
2 files changed
+14
-10
No files matched your search
@@ -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: "<p>Text</p>", 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('<span>天</span>');
|
||||
expect(signed).not.toContain('class="edgeever-card-avatar"');
|
||||
expect(signed).toContain('<span>天马</span>');
|
||||
expect(signed).toContain('<span>天马</span>');
|
||||
expect(signed).not.toContain('class="edgeever-brand-badge"');
|
||||
});
|
||||
|
||||
@@ -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 ? `<div class="edgeever-card-avatar" aria-hidden="true"><span>${initial}</span></div>` : "";
|
||||
const meta: string[] = [];
|
||||
const dateHtml = showUpdatedAt && updatedAt.trim() ? `<div class="edgeever-card-date"><span class="edgeever-meta-date">${escapeCardHtml(updatedAt)}</span></div>` : "";
|
||||
if (showNotebook && notebook.trim()) meta.push(`<span class="edgeever-meta-notebook">${escapeCardHtml(notebook)}</span>`);
|
||||
@@ -237,7 +234,7 @@ export const buildNoteImageCardMarkup = ({
|
||||
</div>`;
|
||||
const footer = hasAuthor || showBranding || meta.length ? `<footer class="edgeever-card-footer">
|
||||
${metaHtml}
|
||||
${hasAuthor ? `<div class="edgeever-footer-author">${avatar}<span>${authorName}</span></div>` : ""}
|
||||
${hasAuthor ? `<div class="edgeever-footer-author"><span>${authorName}</span></div>` : ""}
|
||||
${showBranding ? brandBadgeHtml : ""}
|
||||
</footer>` : "";
|
||||
// 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)};
|
||||
|
||||
Reference in new issue
Block a user