diff --git a/app/src/dialog/tooltip.ts b/app/src/dialog/tooltip.ts index a6e71dc18..fb8596f10 100644 --- a/app/src/dialog/tooltip.ts +++ b/app/src/dialog/tooltip.ts @@ -17,11 +17,6 @@ export const showTooltip = (message: string, target: Element, error = false) => } else { messageElement.innerHTML = message; } - if (target.parentElement.getAttribute("data-type") === "navigation-file") { - const parentRect = target.parentElement.getBoundingClientRect(); - setPosition(messageElement, parentRect.right + 8, parentRect.top); - return; - } if (error) { messageElement.classList.add("tooltip--error"); } else { @@ -33,15 +28,23 @@ export const showTooltip = (message: string, target: Element, error = false) => messageElement.classList.remove("tooltip--memo"); } let left = targetRect.left; - if (target.getAttribute("data-position") === "right") { + let top = targetRect.bottom; + const position = target.getAttribute("data-position") + if (position === "right") { + // block icon left = targetRect.right - messageElement.clientWidth; + } else if (position === "parentE") { + // tree and outline + const parentRect = target.parentElement.getBoundingClientRect(); + top = parentRect.top; + left = parentRect.right + 8; } - const bottomHeight = window.innerHeight - targetRect.bottom; + const bottomHeight = window.innerHeight - top; messageElement.style.maxHeight = Math.max(targetRect.top, bottomHeight) + "px"; if (targetRect.top > bottomHeight) { messageElement.style.top = (targetRect.top - messageElement.clientHeight) + "px"; } else { - messageElement.style.top = targetRect.bottom + "px"; + messageElement.style.top = top + "px"; } if (left + messageElement.clientWidth > window.innerWidth) { messageElement.style.left = (window.innerWidth - messageElement.clientWidth) + "px"; diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts index f0aa7eee1..542bd89ca 100644 --- a/app/src/layout/dock/Files.ts +++ b/app/src/layout/dock/Files.ts @@ -1004,7 +1004,7 @@ class="b3-list-item b3-list-item--hide-action" data-path="${item.path}"> ${unicode2Emoji(item.icon || (item.subFileCount === 0 ? Constants.SIYUAN_IMAGE_FILE : Constants.SIYUAN_IMAGE_FOLDER))} - ${getDisplayName(item.name, true, true)} diff --git a/app/src/util/Tree.ts b/app/src/util/Tree.ts index 94de65d9a..6655a4936 100644 --- a/app/src/util/Tree.ts +++ b/app/src/util/Tree.ts @@ -63,10 +63,10 @@ export class Tree { } else if (item.type === "tag") { iconHTML = ''; } else if (item.type === "backlink") { - titleTip = ` title="${item.hPath}"`; + titleTip = ` aria-label="${item.hPath}"`; iconHTML = ``; } else if (item.type === "outline") { - titleTip = ` title="${Lute.EscapeHTMLStr(Lute.BlockDOM2Content(item.name))}"`; + titleTip = ` aria-label="${Lute.EscapeHTMLStr(Lute.BlockDOM2Content(item.name))}"`; iconHTML = ``; } let countHTML = ""; @@ -94,7 +94,7 @@ ${item.label ? "data-label='" + item.label + "'" : ""}> ${iconHTML} - ${item.name} + ${item.name} ${this.topExtHTML || ""} ${countHTML} `; @@ -148,7 +148,7 @@ data-def-path="${item.defPath}"> ${iconHTML} - ${item.content} + ${item.content} ${countHTML} ${this.blockExtHTML || ""} `;