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/18035

Daniel5a8798cab1b0
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index fda7c556c9..d85f41aa19 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -394,8 +394,11 @@ const updateBlock = (updateElements: Element[], protyle: IProtyle, operation: IO
}
// 表格出现滚动条,更新块后需还原横向滚动位置 https://github.com/siyuan-note/siyuan/issues/3650
let tableScrollLeft: number;
+ let tableScrollTop: number;
if (item.classList.contains("table")) {
tableScrollLeft = (item.firstElementChild as HTMLElement).scrollLeft;
+ // 固定表头后表格出现纵向滚动条,撤销/重做会重置滚动位置 https://github.com/siyuan-note/siyuan/issues/18035
+ tableScrollTop = item.querySelector("table").scrollTop;
}
item.insertAdjacentHTML("afterend",
// 图标撤销后无法渲染
@@ -405,6 +408,9 @@ const updateBlock = (updateElements: Element[], protyle: IProtyle, operation: IO
if (tableScrollLeft > 0) {
(item.firstElementChild as HTMLElement).scrollLeft = tableScrollLeft;
}
+ if (tableScrollTop > 0) {
+ item.querySelector("table").scrollTop = tableScrollTop;
+ }
const wbrElement = item.querySelector("wbr");
if (isRangeBlock && isUndo) {