feat(share): display note icon in reference links

This commit is contained in:
Elian Doran 2025-11-19 09:07:33 +02:00
parent 1ceedf2372
commit ae184ab894
No known key found for this signature in database
2 changed files with 8 additions and 5 deletions

View File

@ -393,17 +393,16 @@ function handleAttachmentLink(linkEl: HTMLElement, href: string, getNote: (id: s
* @param linkEl the <a> element to process.
*/
function cleanUpReferenceLinks(linkEl: HTMLElement) {
// Note: this method is basically a reimplementation of getReferenceLinkTitleSync from the link service of the client.
const noteId = linkEl.getAttribute("href")?.split("/").at(-1);
const note = noteId ? shaca.getNote(noteId) : undefined;
let text = "";
if (!note) {
text = "[missing note]";
linkEl.innerHTML = "[missing note]";
} else if (note.isProtected) {
text = "[protected]";
linkEl.innerHTML = "[protected]";
} else {
text = note.title;
linkEl.innerHTML = `<span><span class="${note.getIcon()}"></span>${note.title}</span>`;
}
linkEl.innerHTML = text;
}
/**

View File

@ -50,6 +50,10 @@
height: auto;
}
a.reference-link > span > .bx {
margin-inline-end: 3px;
}
body:not(.math-loaded) .math-tex {
visibility: hidden;
}