Skip to content

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

:bug: https://github.com/siyuan-note/siyuan/issues/10073

Vanessa5c56c1c542b8
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index e4feda8d19..e898d992dd 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -214,11 +214,22 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Eleme
contentElement.scrollTop = contentElement.scrollTop + cellRect.top - avHeaderRect.bottom;
}
} else {
- const avFooterRect = blockElement.querySelector(".av__row--footer").getBoundingClientRect();
- if (avFooterRect.top < cellRect.bottom) {
+ const footerElement = blockElement.querySelector(".av__row--footer")
+ if (footerElement.querySelector(".av__calc--ashow")) {
+ const avFooterRect = footerElement.getBoundingClientRect();
+ if (avFooterRect.top < cellRect.bottom) {
+ const contentElement = hasClosestByClassName(blockElement, "protyle-content", true);
+ if (contentElement) {
+ contentElement.scrollTop = contentElement.scrollTop + cellRect.bottom - avFooterRect.top;
+ }
+ }
+ } else {
const contentElement = hasClosestByClassName(blockElement, "protyle-content", true);
if (contentElement) {
- contentElement.scrollTop = contentElement.scrollTop + cellRect.bottom - avFooterRect.top;
+ const contentBottom = contentElement.getBoundingClientRect().bottom;
+ if (cellRect.bottom > contentBottom) {
+ contentElement.scrollTop = contentElement.scrollTop + (cellRect.bottom - contentBottom);
+ }
}
}
}
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index 6edce26119..0e56fc04c7 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -15,6 +15,7 @@ import {insertHTML} from "./insertHTML";
import {scrollCenter} from "../../util/highlightById";
import {hideElements} from "../ui/hideElements";
import {avRender} from "../render/av/render";
+import {cellScrollIntoView} from "../render/av/cell";
export const pasteEscaped = async (protyle: IProtyle, nodeElement: Element) => {
try {
@@ -366,5 +367,10 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
highlightRender(protyle.wysiwyg.element);
avRender(protyle.wysiwyg.element, protyle);
}
- scrollCenter(protyle, undefined, false, "smooth");
+ const selectCellElement = nodeElement.querySelector(".av__cell--select");
+ if (nodeElement.classList.contains("av") && selectCellElement) {
+ cellScrollIntoView(nodeElement, selectCellElement);
+ } else {
+ scrollCenter(protyle, undefined, false, "smooth");
+ }
};