diff --git a/app/src/assets/scss/component/_tooltips.scss b/app/src/assets/scss/component/_tooltips.scss index 14e106c67..2fb9745ad 100644 --- a/app/src/assets/scss/component/_tooltips.scss +++ b/app/src/assets/scss/component/_tooltips.scss @@ -1,5 +1,5 @@ .tooltip { - pointer-events: none; + user-select: none; // 同步悬浮需要点击链接,因此不能使用 pointer-events: none; position: fixed; z-index: 1000000; padding: 4px 8px; @@ -16,6 +16,14 @@ animation-fill-mode: both; animation-name: zoomIn; + a { + color: var(--b3-theme-secondary); + + &:hover { + text-decoration: underline; + } + } + &--error { background: var(--b3-theme-error); } diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts index e16108489..caef260f4 100644 --- a/app/src/block/popover.ts +++ b/app/src/block/popover.ts @@ -37,7 +37,7 @@ export const initBlockPopover = (app: App) => { event.stopPropagation(); return; } - } else if (!aElement) { + } else if (!aElement && !hasClosestByAttribute(event.target, "id", "tooltip", true)) { hideTooltip(); } if (window.siyuan.config.editor.floatWindowMode === 1 || window.siyuan.shiftIsPressed) { diff --git a/app/src/dialog/tooltip.ts b/app/src/dialog/tooltip.ts index 3ace54993..1f10b41e3 100644 --- a/app/src/dialog/tooltip.ts +++ b/app/src/dialog/tooltip.ts @@ -26,13 +26,16 @@ export const showTooltip = (message: string, target: Element, error = false) => messageElement.classList.add("tooltip--memo"); // 为行级备注添加 class https://github.com/siyuan-note/siyuan/issues/6161 } let left = targetRect.left; + let topSpace = 8 const position = target.getAttribute("data-position"); if (position === "right") { left = targetRect.right - messageElement.clientWidth; } else if (position === "center") { left = targetRect.left + (targetRect.width - messageElement.clientWidth) / 2; + } else if (position === "top") { + topSpace = 0; } - setPosition(messageElement, left, targetRect.top + targetRect.height + 8, targetRect.height * 2 + 8); + setPosition(messageElement, left, targetRect.top + targetRect.height + topSpace, targetRect.height * 2 + 8); }; export const hideTooltip = () => { diff --git a/app/src/layout/topBar.ts b/app/src/layout/topBar.ts index 3b2e27dfd..67e477576 100644 --- a/app/src/layout/topBar.ts +++ b/app/src/layout/topBar.ts @@ -41,7 +41,7 @@ export const initBar = (app: App) => { ${getWorkspaceName()} -
+