diff --git a/app/src/assets/scss/component/_tooltips.scss b/app/src/assets/scss/component/_tooltips.scss index c1d6c2a58..09abc9137 100644 --- a/app/src/assets/scss/component/_tooltips.scss +++ b/app/src/assets/scss/component/_tooltips.scss @@ -17,6 +17,7 @@ animation-name: zoomIn; max-height: 90vh; overflow: auto; + box-sizing: border-box; a { color: var(--b3-theme-secondary); diff --git a/app/src/config/account.ts b/app/src/config/account.ts index 3712e7ced..bbb73bf28 100644 --- a/app/src/config/account.ts +++ b/app/src/config/account.ts @@ -411,24 +411,24 @@ ${renewHTML} let html = ""; if (window.siyuan.config.account.displayVIP && window.siyuan.user) { if (window.siyuan.user.userSiYuanProExpireTime === -1) { - html = `
`; + html = ``; } else if (window.siyuan.user.userSiYuanProExpireTime > 0) { if (window.siyuan.user.userSiYuanSubscriptionPlan === 2) { - html = ``; + html = ``; } else { - html = ``; + html = ``; } } if (window.siyuan.user.userSiYuanOneTimePayStatus === 1) { - html += ``; + html += ``; } } if (!window.siyuan.user || (window.siyuan.user && window.siyuan.user.userSiYuanSubscriptionStatus === -1)) { - html = ``; + html = ``; } if (window.siyuan.config.account.displayTitle && window.siyuan.user) { window.siyuan.user.userTitles.forEach(item => { - html += ``; + html += ``; }); } document.getElementById("toolbarVIP").innerHTML = html; diff --git a/app/src/dialog/tooltip.ts b/app/src/dialog/tooltip.ts index e0c7c4f4d..c9d5b95af 100644 --- a/app/src/dialog/tooltip.ts +++ b/app/src/dialog/tooltip.ts @@ -29,18 +29,25 @@ export const showTooltip = (message: string, target: Element, error = false) => } if (target.getAttribute("data-inline-memo-content")) { messageElement.classList.add("tooltip--memo"); // 为行级备注添加 class https://github.com/siyuan-note/siyuan/issues/6161 + } else { + messageElement.classList.remove("tooltip--memo"); } let left = targetRect.left; - let topSpace = 8; - const position = target.getAttribute("data-position"); - if (position === "right") { + if (target.getAttribute("data-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 + topSpace, targetRect.height * 2 + 8); + const bottomHeight = window.innerHeight - targetRect.bottom + 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"; + } + if (left + messageElement.clientWidth > window.innerWidth) { + messageElement.style.left = (window.innerWidth - messageElement.clientWidth) + "px"; + } else { + messageElement.style.left = Math.max(0, left) + "px"; + } }; export const hideTooltip = () => { diff --git a/app/src/layout/Tab.ts b/app/src/layout/Tab.ts index 7b4a99201..01b4516b6 100644 --- a/app/src/layout/Tab.ts +++ b/app/src/layout/Tab.ts @@ -36,7 +36,6 @@ export class Tab { this.headElement.setAttribute("data-type", "tab-header"); this.headElement.setAttribute("draggable", "true"); this.headElement.setAttribute("data-id", this.id); - this.headElement.setAttribute("data-position", "center"); // showTooltip 位置标识 this.headElement.classList.add("item", "item--focus"); let iconHTML = ""; if (options.icon) { diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts index 000430f87..97bc887e2 100644 --- a/app/src/layout/Wnd.ts +++ b/app/src/layout/Wnd.ts @@ -63,7 +63,7 @@ export class Wnd {