🎨 防止遮挡可左右滚动的 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

@ -80,7 +80,7 @@
}
&__scroll {
// overflow: auto hidden; 不能使用否则 https://ld246.com/article/1699077234816
overflow: auto hidden;
cursor: pointer;
}

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`;
}

View file

@ -151,7 +151,7 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
}
if (["text", "template", "url", "email", "phone", "number", "date", "created", "updated"].includes(cell.valueType)) {
if (cell.value && cell.value[cell.valueType as "url"].content) {
text += `<span data-type="copy" class="b3-tooltips b3-tooltips__n block__icon" aria-label="${window.siyuan.languages.copy}"><svg><use xlink:href="#iconCopy"></use></svg></span>`;
text += `<span ${cell.valueType !== "number" ? "" : 'style="right:auto;left:5px"'} data-type="copy" class="b3-tooltips b3-tooltips__n block__icon" aria-label="${window.siyuan.languages.copy}"><svg><use xlink:href="#iconCopy"></use></svg></span>`;
}
}
tableHTML += `<div class="av__cell" data-id="${cell.id}" data-col-id="${data.columns[index].id}"

View file

@ -26,7 +26,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
protyle.wysiwyg.element.querySelectorAll(".av").forEach((item: HTMLElement) => {
if (item.parentElement.classList.contains("protyle-wysiwyg")) {
const headerTop = item.offsetTop + 48;
const headerTop = item.offsetTop + 43;
const headerElement = item.querySelector(".av__row--header") as HTMLElement;
if (headerElement) {
if (headerTop < element.scrollTop && headerTop + headerElement.parentElement.clientHeight > element.scrollTop) {