Skip to content

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

:lipstick: 帮助展现位置

Vanessaa043604e549c
diff --git a/app/src/constants.ts b/app/src/constants.ts
index aa6ae865fa..5615f4b464 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -34,7 +34,7 @@ export abstract class Constants {
public static readonly SIYUAN_EXPORT_PREVENT: string = "siyuan-export-prevent";
// size
- public static readonly SIZE_TOOLBAR_HEIGHT: number = 42;
+ public static readonly SIZE_TOOLBAR_HEIGHT: number = 32;
public static readonly SIZE_GET_MAX = 102400;
public static readonly SIZE_UNDO = 64;
public static readonly SIZE_TITLE = 512;
diff --git a/app/src/layout/status.ts b/app/src/layout/status.ts
index 071d5a2b69..dfc952ffc1 100644
--- a/app/src/layout/status.ts
+++ b/app/src/layout/status.ts
@@ -117,7 +117,7 @@ export const initStatus = () => {
}
}).element);
const rect = target.getBoundingClientRect();
- window.siyuan.menus.menu.popup({x: rect.right, y: rect.bottom, h: rect.height}, true);
+ window.siyuan.menus.menu.popup({x: rect.right, y: rect.top}, true);
event.stopPropagation();
break;
} else if (target.classList.contains("b3-menu__item")) {
diff --git a/app/src/util/setPosition.ts b/app/src/util/setPosition.ts
index 5c90fb7628..e0871fd5f8 100644
--- a/app/src/util/setPosition.ts
+++ b/app/src/util/setPosition.ts
@@ -4,22 +4,15 @@ export const setPosition = (element: HTMLElement, x: number, y: number, targetHe
element.style.top = y + "px";
element.style.left = x + "px";
const rect = element.getBoundingClientRect();
- // windows 下悬浮菜单在 drag 位置时无法点击
- let dragBarHeight = 0;
- /// #if !BROWSER
- if ("windows" === window.siyuan.config.system.os) {
- dragBarHeight = document.getElementById("drag").clientHeight;
- }
- /// #endif
// 上下超出屏幕
- if (rect.bottom > window.innerHeight || rect.top < dragBarHeight) {
+ if (rect.bottom > window.innerHeight || rect.top < Constants.SIZE_TOOLBAR_HEIGHT) {
const top = y - rect.height - targetHeight;
- if (top > dragBarHeight && (top + rect.height) < window.innerHeight - dragBarHeight) {
+ if (top > Constants.SIZE_TOOLBAR_HEIGHT && (top + rect.height) < window.innerHeight) {
// 上部
element.style.top = top + "px";
- } else if (top <= dragBarHeight) {
+ } else if (top <= Constants.SIZE_TOOLBAR_HEIGHT) {
// 位置超越到屏幕上方外时,需移动到屏幕顶部。eg:光标在第一个块,然后滚动到上方看不见的位置,按 ctrl+a
- element.style.top = dragBarHeight + "px";
+ element.style.top = Constants.SIZE_TOOLBAR_HEIGHT + "px";
} else {
// 依旧展现在下部,只是位置上移
element.style.top = Math.max(Constants.SIZE_TOOLBAR_HEIGHT, window.innerHeight - rect.height) + "px";