mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
This commit is contained in:
parent
ee36abed5c
commit
b86d583d1a
2 changed files with 8 additions and 4 deletions
|
|
@ -276,7 +276,7 @@ export const copyTab = (app: App, tab: Tab) => {
|
||||||
if (newElement) {
|
if (newElement) {
|
||||||
editor.protyle.observerLoad?.disconnect();
|
editor.protyle.observerLoad?.disconnect();
|
||||||
newElement.scrollIntoView();
|
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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {hideElements} from "../ui/hideElements";
|
import {hideElements} from "../ui/hideElements";
|
||||||
import {setPadding} from "../ui/initUI";
|
import {setPadding} from "../ui/initUI";
|
||||||
import {hasClosestBlock} from "./hasClosest";
|
import {hasClosestBlock, hasClosestByClassName} from "./hasClosest";
|
||||||
import {Constants} from "../../constants";
|
import {Constants} from "../../constants";
|
||||||
import {lineNumberRender} from "../render/highlightRender";
|
import {lineNumberRender} from "../render/highlightRender";
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
|
|
@ -16,6 +16,10 @@ export const recordBeforeResizeTop = () => {
|
||||||
item.editor.protyle.wysiwyg.element.querySelector("[data-resize-top]")?.removeAttribute("data-resize-top");
|
item.editor.protyle.wysiwyg.element.querySelector("[data-resize-top]")?.removeAttribute("data-resize-top");
|
||||||
const contentRect = item.editor.protyle.contentElement.getBoundingClientRect();
|
const contentRect = item.editor.protyle.contentElement.getBoundingClientRect();
|
||||||
let topElement = document.elementFromPoint(contentRect.left + (contentRect.width / 2), contentRect.top);
|
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) {
|
if (!topElement) {
|
||||||
topElement = document.elementFromPoint(contentRect.left + (contentRect.width / 2), contentRect.top + 17);
|
topElement = document.elementFromPoint(contentRect.left + (contentRect.width / 2), contentRect.top + 17);
|
||||||
}
|
}
|
||||||
|
|
@ -26,7 +30,7 @@ export const recordBeforeResizeTop = () => {
|
||||||
if (!topElement) {
|
if (!topElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
topElement.setAttribute("data-resize-top", topElement.getBoundingClientRect().top.toString());
|
topElement.setAttribute("data-resize-top", (contentRect.top - topElement.getBoundingClientRect().top).toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/// #endif
|
/// #endif
|
||||||
|
|
@ -68,7 +72,7 @@ export const resize = (protyle: IProtyle) => {
|
||||||
const topElement = protyle.wysiwyg.element.querySelector("[data-resize-top]");
|
const topElement = protyle.wysiwyg.element.querySelector("[data-resize-top]");
|
||||||
if (topElement) {
|
if (topElement) {
|
||||||
topElement.scrollIntoView();
|
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");
|
topElement.removeAttribute("data-resize-top");
|
||||||
}
|
}
|
||||||
}, Constants.TIMEOUT_TRANSITION + 100); // 等待 setPadding 动画结束
|
}, Constants.TIMEOUT_TRANSITION + 100); // 等待 setPadding 动画结束
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue