mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-06 15:41:48 +01:00
This commit is contained in:
parent
fc71c7abc2
commit
45bfec7d2f
5 changed files with 14 additions and 11 deletions
|
|
@ -6,7 +6,7 @@ import {Constants} from "../../constants";
|
|||
import {setStorageVal} from "../util/compatibility";
|
||||
|
||||
export const saveScroll = (protyle: IProtyle, getObject = false) => {
|
||||
if (!protyle.wysiwyg.element.firstElementChild || window.siyuan.config.readonly || protyle.element.classList.contains("fn__none")) {
|
||||
if (!protyle.wysiwyg.element.firstElementChild || window.siyuan.config.readonly) {
|
||||
// 报错或者空白页面
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -398,8 +398,8 @@ const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScr
|
|||
if (action.includes(Constants.CB_GET_FOCUS) || action.includes(Constants.CB_GET_HL) || action.includes(Constants.CB_GET_FOCUSFIRST)) {
|
||||
const contentRect = protyle.contentElement.getBoundingClientRect();
|
||||
const focusRect = focusElement.getBoundingClientRect();
|
||||
if (contentRect.top > focusRect.top || contentRect.bottom < focusRect.bottom) {
|
||||
scrollCenter(protyle, focusElement, !hasScrollTop);
|
||||
if (!hasScrollTop && (contentRect.top > focusRect.top || contentRect.bottom < focusRect.bottom)) {
|
||||
scrollCenter(protyle, focusElement, true);
|
||||
}
|
||||
} else {
|
||||
protyle.observerLoad?.disconnect();
|
||||
|
|
@ -413,8 +413,8 @@ const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScr
|
|||
if (action.includes(Constants.CB_GET_FOCUS) || action.includes(Constants.CB_GET_HL) || action.includes(Constants.CB_GET_FOCUSFIRST)) {
|
||||
const contentRect = protyle.contentElement.getBoundingClientRect();
|
||||
const focusRect = focusElement.getBoundingClientRect();
|
||||
if (contentRect.top > focusRect.top || contentRect.bottom < focusRect.bottom) {
|
||||
scrollCenter(protyle, focusElement, !hasScrollTop);
|
||||
if (!hasScrollTop && (contentRect.top > focusRect.top || contentRect.bottom < focusRect.bottom)) {
|
||||
scrollCenter(protyle, focusElement, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue