This commit is contained in:
Vanessa 2022-06-21 09:05:18 +08:00
parent 0205a3dc27
commit f7f875e1b3
2 changed files with 20 additions and 1 deletions

View file

@ -23,6 +23,8 @@ import {showMessage} from "../dialog/message";
import {openFileById, updatePanelByEditor} from "../editor/util";
import {scrollCenter} from "../util/highlightById";
import {getAllModels} from "./getAll";
import {fetchPost} from "../util/fetch";
import {onGet} from "../protyle/util/onGet";
export class Wnd {
public id: string;
@ -337,6 +339,22 @@ export class Wnd {
if (update) {
updatePanelByEditor(currentTab.model.editor.protyle, true, pushBack);
}
// 切换到屏幕太高的页签 https://github.com/siyuan-note/siyuan/issues/5018
const protyle = currentTab.model.editor.protyle;
if (!protyle.scroll.element.classList.contains("fn__none") &&
protyle.wysiwyg.element.lastElementChild.getAttribute("data-eof") !== "true" &&
protyle.contentElement.scrollHeight > 0 &&
protyle.contentElement.scrollHeight <= protyle.contentElement.clientHeight) {
fetchPost("/api/filetree/getDoc", {
id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),
mode: 2,
k: protyle.options.key || "",
size: Constants.SIZE_GET,
}, getResponse => {
onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);
});
}
} else {
updatePanelByEditor(undefined, false);
}

View file

@ -178,9 +178,10 @@ const setHTML = (options: { content: string, action?: string[] }, protyle: IProt
if (protyle.element.classList.contains("block__edit") && (protyle.element.nextElementSibling || protyle.element.previousElementSibling)) {
protyle.element.style.minHeight = Math.min(30 + protyle.wysiwyg.element.clientHeight, window.innerHeight / 3) + "px";
}
// https://github.com/siyuan-note/siyuan/issues/5018
// 屏幕太高的页签 https://github.com/siyuan-note/siyuan/issues/5018
if (!protyle.scroll.element.classList.contains("fn__none") &&
protyle.wysiwyg.element.lastElementChild.getAttribute("data-eof") !== "true" &&
protyle.contentElement.scrollHeight > 0 && // 没有激活的页签 https://github.com/siyuan-note/siyuan/issues/5255
protyle.contentElement.scrollHeight <= protyle.contentElement.clientHeight) {
fetchPost("/api/filetree/getDoc", {
id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),