Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/16085

Vanessa212ac6d535b8
diff --git a/app/src/boot/globalEvent/mousemove.ts b/app/src/boot/globalEvent/mousemove.ts
index 69fcdad926..4c79e8e0b9 100644
--- a/app/src/boot/globalEvent/mousemove.ts
+++ b/app/src/boot/globalEvent/mousemove.ts
@@ -221,23 +221,26 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {
if (blockElement && blockElement.style.cursor !== "col-resize" && !hasClosestByClassName(blockElement, "protyle-wysiwyg__embed")) {
const cellElement = (hasClosestByTag(target, "TH") || hasClosestByTag(target, "TD")) as HTMLTableCellElement;
const tableElement = blockElement.querySelector("table");
- if (cellElement && tableElement && tableElement.getAttribute("contenteditable") === "true") {
- const tableHeight = blockElement.querySelector("colgroup").clientHeight;
- const captionElement = blockElement.querySelector("caption");
- const captionHeight = (captionElement && captionElement.style.captionSide !== "bottom") ? captionElement.clientHeight : 0;
+ if (cellElement && tableElement) {
const resizeElement = blockElement.querySelector(".table__resize");
if (blockElement.style.textAlign === "center" || blockElement.style.textAlign === "right") {
resizeElement.parentElement.style.left = tableElement.offsetLeft + "px";
} else {
resizeElement.parentElement.style.left = "";
}
- const rect = cellElement.getBoundingClientRect();
- if (rect.right - event.clientX < 3 && rect.right - event.clientX > 0) {
- resizeElement.setAttribute("data-col-index", (getColIndex(cellElement) + cellElement.colSpan - 1).toString());
- resizeElement.setAttribute("style", `top:${captionHeight}px;height:${tableHeight}px;left: ${Math.round(cellElement.offsetWidth + cellElement.offsetLeft - blockElement.firstElementChild.scrollLeft - 3)}px;display:block`);
- } else if (event.clientX - rect.left < 3 && event.clientX - rect.left > 0 && cellElement.previousElementSibling) {
- resizeElement.setAttribute("data-col-index", (getColIndex(cellElement) - 1).toString());
- resizeElement.setAttribute("style", `top:${captionHeight}px;height:${tableHeight}px;left: ${Math.round(cellElement.offsetLeft - blockElement.firstElementChild.scrollLeft - 3)}px;display:block`);
+
+ if (tableElement.getAttribute("contenteditable") === "true") {
+ const tableHeight = blockElement.querySelector("colgroup").clientHeight;
+ const captionElement = blockElement.querySelector("caption");
+ const captionHeight = (captionElement && captionElement.style.captionSide !== "bottom") ? captionElement.clientHeight : 0;
+ const rect = cellElement.getBoundingClientRect();
+ if (rect.right - event.clientX < 3 && rect.right - event.clientX > 0) {
+ resizeElement.setAttribute("data-col-index", (getColIndex(cellElement) + cellElement.colSpan - 1).toString());
+ resizeElement.setAttribute("style", `top:${captionHeight}px;height:${tableHeight}px;left: ${Math.round(cellElement.offsetWidth + cellElement.offsetLeft - blockElement.firstElementChild.scrollLeft - 3)}px;display:block`);
+ } else if (event.clientX - rect.left < 3 && event.clientX - rect.left > 0 && cellElement.previousElementSibling) {
+ resizeElement.setAttribute("data-col-index", (getColIndex(cellElement) - 1).toString());
+ resizeElement.setAttribute("style", `top:${captionHeight}px;height:${tableHeight}px;left: ${Math.round(cellElement.offsetLeft - blockElement.firstElementChild.scrollLeft - 3)}px;display:block`);
+ }
}
}
}