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

Vanessab86d583d1a27
diff --git a/app/src/layout/tabUtil.ts b/app/src/layout/tabUtil.ts
index 677725f906..0c520ddda4 100644
--- a/app/src/layout/tabUtil.ts
+++ b/app/src/layout/tabUtil.ts
@@ -276,7 +276,7 @@ export const copyTab = (app: App, tab: Tab) => {
if (newElement) {
editor.protyle.observerLoad?.disconnect();
newElement.scrollIntoView();
- editor.protyle.contentElement.scrollTop += newElement.getBoundingClientRect().top - parseInt(copyResizeTopElement.getAttribute("data-resize-top"));
+ editor.protyle.contentElement.scrollTop += parseInt(copyResizeTopElement.getAttribute("data-resize-top"));
}
}
}
diff --git a/app/src/protyle/util/resize.ts b/app/src/protyle/util/resize.ts
index c2c1c88752..3ef367ba16 100644
--- a/app/src/protyle/util/resize.ts
+++ b/app/src/protyle/util/resize.ts
@@ -1,6 +1,6 @@
import {hideElements} from "../ui/hideElements";
import {setPadding} from "../ui/initUI";
-import {hasClosestBlock} from "./hasClosest";
+import {hasClosestBlock, hasClosestByClassName} from "./hasClosest";
import {Constants} from "../../constants";
import {lineNumberRender} from "../render/highlightRender";
/// #if !MOBILE
@@ -16,6 +16,10 @@ export const recordBeforeResizeTop = () => {
item.editor.protyle.wysiwyg.element.querySelector("[data-resize-top]")?.removeAttribute("data-resize-top");
const contentRect = item.editor.protyle.contentElement.getBoundingClientRect();
let topElement = document.elementFromPoint(contentRect.left + (contentRect.width / 2), contentRect.top);
+ if (hasClosestByClassName(topElement, "b3-menu")) {
+ window.siyuan.menus.menu.remove();
+ topElement = document.elementFromPoint(contentRect.left + (contentRect.width / 2), contentRect.top);
+ }
if (!topElement) {
topElement = document.elementFromPoint(contentRect.left + (contentRect.width / 2), contentRect.top + 17);
}
@@ -26,7 +30,7 @@ export const recordBeforeResizeTop = () => {
if (!topElement) {
return;
}
- topElement.setAttribute("data-resize-top", topElement.getBoundingClientRect().top.toString());
+ topElement.setAttribute("data-resize-top", (contentRect.top - topElement.getBoundingClientRect().top).toString());
}
});
/// #endif
@@ -68,7 +72,7 @@ export const resize = (protyle: IProtyle) => {
const topElement = protyle.wysiwyg.element.querySelector("[data-resize-top]");
if (topElement) {
topElement.scrollIntoView();
- protyle.contentElement.scrollTop += topElement.getBoundingClientRect().top - parseInt(topElement.getAttribute("data-resize-top"));
+ protyle.contentElement.scrollTop += parseInt(topElement.getAttribute("data-resize-top"));
topElement.removeAttribute("data-resize-top");
}
}, Constants.TIMEOUT_TRANSITION + 100); // 等待 setPadding 动画结束