mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-22 03:50:55 +08:00
This commit is contained in:
parent
cff3266ce2
commit
ddfc69df03
@ -5,7 +5,7 @@ import {onGet} from "../util/onGet";
|
|||||||
import {showMessage} from "../../dialog/message";
|
import {showMessage} from "../../dialog/message";
|
||||||
import {updateHotkeyTip} from "../util/compatibility";
|
import {updateHotkeyTip} from "../util/compatibility";
|
||||||
import {isMobile} from "../../util/functions";
|
import {isMobile} from "../../util/functions";
|
||||||
import {hasClosestBlock} from "../util/hasClosest";
|
import {hasClosestBlock, hasClosestByClassName} from "../util/hasClosest";
|
||||||
|
|
||||||
let getIndexTimeout: number
|
let getIndexTimeout: number
|
||||||
export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
||||||
@ -47,9 +47,14 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
|
|||||||
getIndexTimeout = window.setTimeout(() => {
|
getIndexTimeout = window.setTimeout(() => {
|
||||||
elementRect = element.getBoundingClientRect();
|
elementRect = element.getBoundingClientRect();
|
||||||
const targetElement = document.elementFromPoint(elementRect.left + elementRect.width / 2, elementRect.top + 10)
|
const targetElement = document.elementFromPoint(elementRect.left + elementRect.width / 2, elementRect.top + 10)
|
||||||
console.log(targetElement, hasClosestBlock(targetElement), event);
|
|
||||||
const blockElement = hasClosestBlock(targetElement);
|
const blockElement = hasClosestBlock(targetElement);
|
||||||
if (!blockElement) {
|
if (!blockElement) {
|
||||||
|
if (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;
|
return;
|
||||||
}
|
}
|
||||||
fetchPost("/api/block/getBlockIndex", {id: blockElement.getAttribute("data-node-id")}, (response) => {
|
fetchPost("/api/block/getBlockIndex", {id: blockElement.getAttribute("data-node-id")}, (response) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user