Skip to content

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

:art: Refine bottom dock tooltip positioning https://github.com/siyuan-note/siyuan/issues/12474

Daniel5492159b3952
diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.ts
index a9d8e048de..2e23c18d16 100644
--- a/app/src/layout/dock/index.ts
+++ b/app/src/layout/dock/index.ts
@@ -818,12 +818,7 @@ export class Dock {
delete sourceDock.data[type];
// 目标处理
sourceElement.setAttribute("data-index", index.toString());
- const tooltipPosition = this.getTooltipPosition();
- if (tooltipPosition) {
- sourceElement.setAttribute("data-position", tooltipPosition);
- } else {
- sourceElement.removeAttribute("data-position");
- }
+ sourceElement.setAttribute("data-position", this.getTooltipPosition(index));
if (previousType) {
this.elements[index].parentElement.querySelector(`[data-type="${previousType}"]`).after(sourceElement);
} else {
@@ -930,7 +925,7 @@ export class Dock {
public genButton(data: Config.IUILayoutDockTab[], index: number, tabIndex?: number) {
let html = "";
- const tooltipPosition = this.getTooltipPosition();
+ const tooltipPosition = this.getTooltipPosition(index);
data.forEach(item => {
if (typeof tabIndex === "undefined" && !TYPES.includes(item.type)) {
return;
@@ -941,7 +936,7 @@ export class Dock {
} else if (item.type === "tags") {
item.icon = "iconTag";
}
- html += `<span data-height="${item.size.height}" data-width="${item.size.width}" data-type="${item.type}" data-index="${index}" data-hotkey="${item.hotkey || ""}" data-hotkeylangid="${item.hotkeyLangId || ""}" data-title="${item.title}"${tooltipPosition ? ` data-position="${tooltipPosition}"` : ""} class="dock__item${item.show ? " dock__item--active" : ""} ariaLabel" aria-label="<span style='white-space:pre'>${item.title} ${item.hotkey ? updateHotkeyTip(item.hotkey) : ""}${window.siyuan.languages.dockTip}</span>">
+ html += `<span data-height="${item.size.height}" data-width="${item.size.width}" data-type="${item.type}" data-index="${index}" data-hotkey="${item.hotkey || ""}" data-hotkeylangid="${item.hotkeyLangId || ""}" data-title="${item.title}" data-position="${tooltipPosition}" class="dock__item${item.show ? " dock__item--active" : ""} ariaLabel" aria-label="<span style='white-space:pre'>${item.title} ${item.hotkey ? updateHotkeyTip(item.hotkey) : ""}${window.siyuan.languages.dockTip}</span>">
<svg><use xlink:href="#${item.icon}"></use></svg>
</span>`;
this.data[item.type] = true;
@@ -971,14 +966,11 @@ export class Dock {
this.adjustSplit();
}
- private getTooltipPosition() {
- if (this.position === "Left") {
+ private getTooltipPosition(index: number) {
+ if (this.position === "Left" || (this.position === "Bottom" && index === 0)) {
return "8east";
}
- if (this.position === "Right") {
- return "8west";
- }
- return "";
+ return "8west";
}
private adjustSplit() {