🐛 sync tip 转义及支持点击

This commit is contained in:
Vanessa 2023-06-19 21:01:57 +08:00
parent b2c0f3ea1f
commit 887443c321
4 changed files with 23 additions and 11 deletions

View file

@ -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 = () => {