Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/12615

Vanessa4734bb81dca2
diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts
index 3646ed3408..5ec3ad4b91 100644
--- a/app/src/block/popover.ts
+++ b/app/src/block/popover.ts
@@ -9,6 +9,7 @@ import {getCellText} from "../protyle/render/av/cell";
import {isTouchDevice} from "../util/functions";
let popoverTargetElement: HTMLElement;
+let notebookItemElement: HTMLElement | false;
export const initBlockPopover = (app: App) => {
let timeout: number;
let timeoutHide: number;
@@ -87,11 +88,22 @@ export const initBlockPopover = (app: App) => {
hideTooltip();
}
} else if (!aElement) {
- const notebookItemElement = hasClosestByClassName(event.target, "b3-list-item__text");
+ notebookItemElement = hasClosestByClassName(event.target, "b3-list-item__text");
if (notebookItemElement && notebookItemElement.parentElement.getAttribute("data-type") === "navigation-root") {
+ showTooltip(notebookItemElement.getAttribute("aria-label") || "", notebookItemElement);
fetchPost("/api/notebook/getNotebookInfo", {notebook: notebookItemElement.parentElement.parentElement.getAttribute("data-url")}, (response) => {
const boxData = response.data.boxInfo;
- showTooltip(`${boxData.name} <small class='ft__on-surface'>${boxData.hSize}</small>${boxData.docCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", boxData.docCount) : ""}<br>${window.siyuan.languages.modifiedAt} ${boxData.hMtime}<br>${window.siyuan.languages.createdAt} ${boxData.hCtime}`,notebookItemElement)
+ const tip = `${boxData.name} <small class='ft__on-surface'>${boxData.hSize}</small>${boxData.docCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", boxData.docCount) : ""}<br>${window.siyuan.languages.modifiedAt} ${boxData.hMtime}<br>${window.siyuan.languages.createdAt} ${boxData.hCtime}`
+
+ const newNotebookItemElement = hasClosestByClassName(event.target, "b3-list-item__text");
+ if (notebookItemElement && newNotebookItemElement && notebookItemElement.isSameNode(newNotebookItemElement)) {
+ showTooltip(tip, notebookItemElement);
+ }
+ if (newNotebookItemElement &&
+ newNotebookItemElement.parentElement.getAttribute("data-type") === "navigation-root" &&
+ newNotebookItemElement.parentElement.parentElement.getAttribute("data-url") === boxData.id) {
+ newNotebookItemElement.setAttribute("aria-label", tip);
+ }
})
} else {
const tipElement = hasClosestByAttribute(event.target, "id", "tooltip", true);
diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts
index d5027e0707..8eedf4ca94 100644
--- a/app/src/layout/dock/Files.ts
+++ b/app/src/layout/dock/Files.ts
@@ -724,7 +724,7 @@ export class Files extends Model {
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span>
${emojiHTML}
- <span class="b3-list-item__text">${escapeHtml(item.name)}</span>
+ <span class="b3-list-item__text" data-position="parentE">${escapeHtml(item.name)}</span>
<span data-type="more-root" class="b3-list-item__action b3-tooltips b3-tooltips__w${(window.siyuan.config.readonly) ? " fn__none" : ""}" aria-label="${window.siyuan.languages.more}">
<svg><use xlink:href="#iconMore"></use></svg>
</span>