An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/13828
Daniel8305da6db30e
diff --git a/app/src/assets/scss/protyle/_protyle.scss b/app/src/assets/scss/protyle/_protyle.scssindex 71b6c8f81d..3ce33271c7 100644--- a/app/src/assets/scss/protyle/_protyle.scss+++ b/app/src/assets/scss/protyle/_protyle.scss@@ -444,6 +444,11 @@ table[contenteditable="false"] + .protyle-action__table > .table__resize {display: none !important;}+// 按下 Shift 时隐藏表格列宽调整手柄,以便 Shift+滚轮可以横向滚动表格 https://github.com/siyuan-note/siyuan/issues/13828+body.shift--pressed .table__resize {+ display: none !important;+}+table + .protyle-action__table {position: absolute;top: 4px;diff --git a/app/src/boot/globalEvent/commonHotkey.ts b/app/src/boot/globalEvent/commonHotkey.tsindex fdc7c49912..59369b41ca 100644--- a/app/src/boot/globalEvent/commonHotkey.ts+++ b/app/src/boot/globalEvent/commonHotkey.ts@@ -187,11 +187,14 @@ export const filterHotkey = (event: KeyboardEvent, app: App) => {if (!event.altKey && event.shiftKey && isNotCtrl(event)) {if (event.key === "Shift") {window.siyuan.shiftIsPressed = true;+ // 按下 Shift 时隐藏表格列宽调整手柄,以便 Shift+滚轮可以横向滚动表格 https://github.com/siyuan-note/siyuan/issues/13828+ document.body.classList.add("shift--pressed");if (!event.repeat) {showPopover(app, true);}} else {window.siyuan.shiftIsPressed = false;+ document.body.classList.remove("shift--pressed");}}diff --git a/app/src/boot/globalEvent/event.ts b/app/src/boot/globalEvent/event.tsindex 61db6c99a6..16f1fe000d 100644--- a/app/src/boot/globalEvent/event.ts+++ b/app/src/boot/globalEvent/event.ts@@ -40,6 +40,26 @@ export const initWindowEvent = (app: App) => {windowMouseMove(event, mouseIsEnter);});+ // 横向滚动表格时重新定位表格列宽调整手柄 https://github.com/siyuan-note/siyuan/issues/13828+ window.addEventListener("scroll", (event: Event) => {+ const scrollElement = event.target as HTMLElement;+ // 仅处理表格内容容器(.table 块的 firstElementChild)的滚动+ if (!scrollElement.parentElement || !scrollElement.parentElement.classList.contains("table")) {+ return;+ }+ const resizeElement = scrollElement.parentElement.querySelector(".table__resize") as HTMLElement;+ if (!resizeElement) {+ return;+ }+ const baseLeft = resizeElement.getAttribute("data-left");+ const style = resizeElement.getAttribute("style");+ if (baseLeft === null || !style || style.indexOf("display:block") === -1) {+ return;+ }+ const left = parseInt(baseLeft) - scrollElement.scrollLeft;+ resizeElement.setAttribute("style", style.replace(/left: ?-?\d+px;/, `left: ${Math.round(left)}px;`));+ }, true);+let scrollTarget: HTMLElement | false;window.addEventListener("dragover", (event: DragEvent & { target: HTMLElement }) => {if (event.dataTransfer.types.includes("text/plain")) {@@ -116,6 +136,7 @@ export const initWindowEvent = (app: App) => {window.siyuan.ctrlIsPressed = false;window.siyuan.shiftIsPressed = false;window.siyuan.altIsPressed = false;+ document.body.classList.remove("shift--pressed");/// #if BROWSERsetWebViewFocusable();/// #endifdiff --git a/app/src/boot/globalEvent/keyup.ts b/app/src/boot/globalEvent/keyup.tsindex 9919a9b3d9..b1106fc1ee 100644--- a/app/src/boot/globalEvent/keyup.ts+++ b/app/src/boot/globalEvent/keyup.ts@@ -12,6 +12,7 @@ export const windowKeyUp = (app: App, event: KeyboardEvent) => {window.siyuan.ctrlIsPressed = false;window.siyuan.shiftIsPressed = false;window.siyuan.altIsPressed = false;+ document.body.classList.remove("shift--pressed");const switchDialog = window.siyuan.dialogs.find(item => {if (item.element.getAttribute("data-key") === Constants.DIALOG_SWITCHTAB) {return true;diff --git a/app/src/boot/globalEvent/mousemove.ts b/app/src/boot/globalEvent/mousemove.tsindex 43d2c5f0b2..94d100d1a7 100644--- a/app/src/boot/globalEvent/mousemove.ts+++ b/app/src/boot/globalEvent/mousemove.ts@@ -257,9 +257,12 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {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());+ // 记录基础 left(不含 scrollLeft),以便横向滚动后重新定位 https://github.com/siyuan-note/siyuan/issues/13828+ resizeElement.setAttribute("data-left", (cellElement.offsetWidth + cellElement.offsetLeft - 3).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("data-left", (cellElement.offsetLeft - 3).toString());resizeElement.setAttribute("style", `top:${captionHeight}px;height:${tableHeight}px;left: ${Math.round(cellElement.offsetLeft - blockElement.firstElementChild.scrollLeft - 3)}px;display:block`);}}