|
@@ -39,22 +39,15 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
|
|
const targetElement = document.elementFromPoint(elementRect.left + elementRect.width / 2, elementRect.top + 10);
|
|
|
const blockElement = hasClosestBlock(targetElement);
|
|
|
if (!blockElement) {
|
|
|
- if (hasClosestByClassName(targetElement, "protyle-background") ||
|
|
|
- hasClosestByClassName(targetElement, "protyle-title")) {
|
|
|
+ if (protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") === "1" &&
|
|
|
+ (hasClosestByClassName(targetElement, "protyle-background") || hasClosestByClassName(targetElement, "protyle-title"))) {
|
|
|
const inputElement = protyle.scroll.element.querySelector(".b3-slider") as HTMLInputElement;
|
|
|
inputElement.value = "1";
|
|
|
protyle.scroll.element.setAttribute("aria-label", `Blocks 1/${protyle.block.blockCount}`);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
- fetchPost("/api/block/getBlockIndex", {id: blockElement.getAttribute("data-node-id")}, (response) => {
|
|
|
- if (!response.data) {
|
|
|
- return;
|
|
|
- }
|
|
|
- const inputElement = protyle.scroll.element.querySelector(".b3-slider") as HTMLInputElement;
|
|
|
- inputElement.value = response.data;
|
|
|
- protyle.scroll.element.setAttribute("aria-label", `Blocks ${response.data}/${protyle.block.blockCount}`);
|
|
|
- });
|
|
|
+ protyle.scroll.updateIndex(protyle, blockElement.getAttribute("data-node-id"));
|
|
|
}, Constants.TIMEOUT_LOAD);
|
|
|
}
|
|
|
if (protyle.wysiwyg.element.getAttribute("data-top") || protyle.block.showAll ||
|
|
@@ -65,7 +58,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
|
|
if (protyle.scroll.lastScrollTop - element.scrollTop > 0) {
|
|
|
// up
|
|
|
if (element.scrollTop < element.clientHeight &&
|
|
|
- protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") !== "true") {
|
|
|
+ protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") !== "1") {
|
|
|
// 禁用滚动时会产生抖动 https://ld246.com/article/1666717094418
|
|
|
protyle.contentElement.style.width = (protyle.contentElement.clientWidth) + "px";
|
|
|
protyle.contentElement.style.overflow = "hidden";
|
|
@@ -83,7 +76,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
|
|
}
|
|
|
} else if ((element.scrollTop > element.scrollHeight - element.clientHeight * 1.8) &&
|
|
|
protyle.wysiwyg.element.lastElementChild &&
|
|
|
- protyle.wysiwyg.element.lastElementChild.getAttribute("data-eof") !== "true") {
|
|
|
+ protyle.wysiwyg.element.lastElementChild.getAttribute("data-eof") !== "2") {
|
|
|
protyle.wysiwyg.element.setAttribute("data-top", element.scrollTop.toString());
|
|
|
fetchPost("/api/filetree/getDoc", {
|
|
|
id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),
|