mirror of
https://github.com/zadam/trilium.git
synced 2025-11-21 08:04:24 +01:00
feat(share): display note icon in reference links
This commit is contained in:
parent
1ceedf2372
commit
ae184ab894
@ -393,17 +393,16 @@ function handleAttachmentLink(linkEl: HTMLElement, href: string, getNote: (id: s
|
|||||||
* @param linkEl the <a> element to process.
|
* @param linkEl the <a> element to process.
|
||||||
*/
|
*/
|
||||||
function cleanUpReferenceLinks(linkEl: HTMLElement) {
|
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 noteId = linkEl.getAttribute("href")?.split("/").at(-1);
|
||||||
const note = noteId ? shaca.getNote(noteId) : undefined;
|
const note = noteId ? shaca.getNote(noteId) : undefined;
|
||||||
let text = "";
|
|
||||||
if (!note) {
|
if (!note) {
|
||||||
text = "[missing note]";
|
linkEl.innerHTML = "[missing note]";
|
||||||
} else if (note.isProtected) {
|
} else if (note.isProtected) {
|
||||||
text = "[protected]";
|
linkEl.innerHTML = "[protected]";
|
||||||
} else {
|
} else {
|
||||||
text = note.title;
|
linkEl.innerHTML = `<span><span class="${note.getIcon()}"></span>${note.title}</span>`;
|
||||||
}
|
}
|
||||||
linkEl.innerHTML = text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -50,6 +50,10 @@
|
|||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.reference-link > span > .bx {
|
||||||
|
margin-inline-end: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
body:not(.math-loaded) .math-tex {
|
body:not(.math-loaded) .math-tex {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user