mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 03:00:41 +01:00
feat(note_tooltip): improve layout for empty notes
This commit is contained in:
@@ -140,10 +140,6 @@ async function renderTooltip(note: FNote | null) {
|
||||
}
|
||||
|
||||
const noteTitleWithPathAsSuffix = await treeService.getNoteTitleWithPathAsSuffix(bestNotePath);
|
||||
let content = "";
|
||||
if (noteTitleWithPathAsSuffix) {
|
||||
content = `<h5 class="note-tooltip-title">${noteTitleWithPathAsSuffix.prop("outerHTML")}</h5>`;
|
||||
}
|
||||
|
||||
const { $renderedAttributes } = await attributeRenderer.renderNormalAttributes(note);
|
||||
|
||||
@@ -151,8 +147,21 @@ async function renderTooltip(note: FNote | null) {
|
||||
tooltip: true,
|
||||
trim: true
|
||||
});
|
||||
const isContentEmpty = ($renderedContent[0].innerHTML.length === 0);
|
||||
|
||||
content = `${content}<div class="note-tooltip-attributes">${$renderedAttributes[0].outerHTML}</div>${$renderedContent[0].outerHTML}`;
|
||||
let content = "";
|
||||
if (noteTitleWithPathAsSuffix) {
|
||||
const classes = [ "note-tooltip-title" ];
|
||||
if (isContentEmpty) {
|
||||
classes.push("note-no-content");
|
||||
}
|
||||
content = `<h5 class="${classes.join(" ")}">${noteTitleWithPathAsSuffix.prop("outerHTML")}</h5>`;
|
||||
}
|
||||
|
||||
content = `${content}<div class="note-tooltip-attributes">${$renderedAttributes[0].outerHTML}</div>`;
|
||||
if (!isContentEmpty) {
|
||||
content += $renderedContent[0].outerHTML;
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user