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

Vanessa2f3410ad51c0
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index 53190974f6..c5413d137b 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -392,11 +392,19 @@ const updateBlock = (updateElements: Element[], protyle: IProtyle, operation: IO
if (range && item.contains(range.startContainer)) {
isRangeBlock = true;
}
+ // 表格出现滚动条,更新块后需还原横向滚动位置 https://github.com/siyuan-note/siyuan/issues/3650
+ let tableScrollLeft: number;
+ if (item.classList.contains("table")) {
+ tableScrollLeft = (item.firstElementChild as HTMLElement).scrollLeft;
+ }
item.insertAdjacentHTML("afterend",
// 图标撤销后无法渲染
item.getAttribute("data-subtype") === "echarts" ? protyle.lute.SpinBlockDOM(operation.data) : operation.data);
item = item.nextElementSibling;
item.previousElementSibling.remove();
+ if (tableScrollLeft > 0) {
+ (item.firstElementChild as HTMLElement).scrollLeft = tableScrollLeft;
+ }
const wbrElement = item.querySelector("wbr");
if (isRangeBlock && isUndo) {