🎨 防止遮挡可左右滚动的 cell

This commit is contained in:
Vanessa 2023-11-08 11:53:37 +08:00
parent ec3acdb978
commit b63bd96992
4 changed files with 13 additions and 6 deletions

View file

@ -1916,11 +1916,18 @@ data-type="fold"><svg style="width:10px${fold && fold === "1" ? "" : ";transform
}
if (nodeElement.getAttribute("data-type") === "NodeAttributeView") {
const iconElement = nodeElement.querySelector(".item__graphic");
let top = rect.top + 8
if (iconElement) {
this.element.style.top = `${Math.max(iconElement.getBoundingClientRect().top - (window.siyuan.config.editor.fontSize * 1.625 - 14) / 2, wysiwyg.parentElement.getBoundingClientRect().top)}px`;
} else {
this.element.style.top = `${Math.max(rect.top, wysiwyg.parentElement.getBoundingClientRect().top) + 8}px`;
top = iconElement.getBoundingClientRect().top - (window.siyuan.config.editor.fontSize * 1.625 - 14) / 2;
}
// 防止遮挡可左右滚动的 cell
const maxTop = wysiwyg.parentElement.getBoundingClientRect().top
if (top < maxTop - 43) {
top = -1000
} else if (top > maxTop - 43 && top <= maxTop) {
top = maxTop
}
this.element.style.top = `${top}px`;
} else {
this.element.style.top = `${Math.max(rect.top, wysiwyg.parentElement.getBoundingClientRect().top) + marginHeight}px`;
}