mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-21 07:46:09 +01:00
This commit is contained in:
parent
8c35440a77
commit
74b4a00a2f
42 changed files with 426 additions and 270 deletions
|
|
@ -4,9 +4,10 @@ import {fetchPost} from "../../util/fetch";
|
|||
import {onGet} from "../util/onGet";
|
||||
import {isMobile} from "../../util/functions";
|
||||
import {hasClosestBlock, hasClosestByClassName} from "../util/hasClosest";
|
||||
import {App} from "../../index";
|
||||
|
||||
let getIndexTimeout: number;
|
||||
export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
||||
export const scrollEvent = (app: App, protyle: IProtyle, element: HTMLElement) => {
|
||||
let elementRect = element.getBoundingClientRect();
|
||||
element.addEventListener("scroll", () => {
|
||||
if (!protyle.toolbar.element.classList.contains("fn__none")) {
|
||||
|
|
@ -70,7 +71,12 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
|||
}, getResponse => {
|
||||
protyle.contentElement.style.overflow = "";
|
||||
protyle.contentElement.style.width = "";
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_BEFORE, Constants.CB_GET_UNCHANGEID]);
|
||||
onGet({
|
||||
data: getResponse,
|
||||
protyle,
|
||||
action: [Constants.CB_GET_BEFORE, Constants.CB_GET_UNCHANGEID],
|
||||
app
|
||||
});
|
||||
});
|
||||
}
|
||||
} else if ((element.scrollTop > element.scrollHeight - element.clientHeight * 1.8) &&
|
||||
|
|
@ -82,7 +88,12 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
|||
mode: 2,
|
||||
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);
|
||||
onGet({
|
||||
data: getResponse,
|
||||
protyle,
|
||||
action: [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID],
|
||||
app
|
||||
});
|
||||
});
|
||||
}
|
||||
protyle.scroll.lastScrollTop = Math.max(element.scrollTop, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue