This commit is contained in:
Vanessa 2023-03-30 18:15:20 +08:00
parent f01a347c6d
commit 1917857b60
7 changed files with 28 additions and 28 deletions

View file

@ -946,9 +946,9 @@ powerMonitor.on("resume", async () => {
// 桌面端系统休眠唤醒后判断网络连通性后再执行数据同步 https://github.com/siyuan-note/siyuan/issues/6687
writeLog("system resume");
const eNet = require("electron").net
const eNet = require("electron").net;
const isOnline = async () => {
return eNet.isOnline()
return eNet.isOnline();
};
let online = false;
for (let i = 0; i < 7; i++) {

View file

@ -142,7 +142,7 @@ export const viewCards = (deckID: string, title: string, deckType: "Tree" | "" |
target.parentElement.remove();
}
dialog.element.querySelector(".counter").textContent = (parseInt(dialog.element.querySelector(".counter").textContent) - 1).toString()
dialog.element.querySelector(".counter").textContent = (parseInt(dialog.element.querySelector(".counter").textContent) - 1).toString();
if (cb) {
cb(removeResponse);
}

View file

@ -23,10 +23,10 @@ ${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__
element.firstElementChild.addEventListener("click", (event) => {
const liElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item");
if (liElement) {
openMobileFileById(liElement.dataset.nodeId, [Constants.CB_GET_SCROLL])
openMobileFileById(liElement.dataset.nodeId, [Constants.CB_GET_SCROLL]);
}
});
}
})
});
}
});
};

View file

@ -203,4 +203,4 @@ ${accountHTML}
target = target.parentElement;
}
});
}
};

View file

@ -20,28 +20,28 @@ export const handleTouchEnd = (event: TouchEvent) => {
return;
}
const target = event.target as HTMLElement
let scrollElement = hasClosestByAttribute(target, "data-type", "NodeCodeBlock") || hasClosestByAttribute(target, "data-type", "NodeTable")
const target = event.target as HTMLElement;
let scrollElement = hasClosestByAttribute(target, "data-type", "NodeCodeBlock") || hasClosestByAttribute(target, "data-type", "NodeTable");
if (scrollElement) {
scrollElement = scrollElement.classList.contains("table") ? (scrollElement.firstElementChild as HTMLElement) : (scrollElement.firstElementChild.nextElementSibling as HTMLElement)
scrollElement = scrollElement.classList.contains("table") ? (scrollElement.firstElementChild as HTMLElement) : (scrollElement.firstElementChild.nextElementSibling as HTMLElement);
if ((xDiff < 0 && scrollElement.scrollLeft > 0) ||
(xDiff > 0 && scrollElement.clientWidth + scrollElement.scrollLeft < scrollElement.scrollWidth)) {
return;
}
}
let show = false
let show = false;
if (new Date().getTime() - time < 1000) {
show = true
show = true;
} else if (Math.abs(xDiff) > window.innerWidth / 3) {
show = true
show = true;
}
const menuElement = hasClosestByAttribute(target, "id", "menu")
const menuElement = hasClosestByAttribute(target, "id", "menu");
if (show && menuElement && xDiff < 0) {
closePanel();
return;
}
const sideElement = hasClosestByAttribute(target, "id", "sidebar")
const sideElement = hasClosestByAttribute(target, "id", "sidebar");
if (show && sideElement && xDiff > 0) {
closePanel();
return;
@ -54,7 +54,7 @@ export const handleTouchEnd = (event: TouchEvent) => {
if (xDiff > 0) {
popMenu();
} else {
document.getElementById("toolbarFile").dispatchEvent(new CustomEvent("click"))
document.getElementById("toolbarFile").dispatchEvent(new CustomEvent("click"));
}
}
};
@ -83,30 +83,30 @@ export const handleTouchMove = (event: TouchEvent) => {
yDiff = Math.floor(clientY - event.touches[0].clientY);
if (Math.abs(xDiff) > Math.abs(yDiff)) {
const target = event.target as HTMLElement
let scrollElement = hasClosestByAttribute(target, "data-type", "NodeCodeBlock") || hasClosestByAttribute(target, "data-type", "NodeTable")
const target = event.target as HTMLElement;
let scrollElement = hasClosestByAttribute(target, "data-type", "NodeCodeBlock") || hasClosestByAttribute(target, "data-type", "NodeTable");
if (scrollElement) {
scrollElement = scrollElement.classList.contains("table") ? (scrollElement.firstElementChild as HTMLElement) : (scrollElement.firstElementChild.nextElementSibling as HTMLElement)
scrollElement = scrollElement.classList.contains("table") ? (scrollElement.firstElementChild as HTMLElement) : (scrollElement.firstElementChild.nextElementSibling as HTMLElement);
if ((xDiff < 0 && scrollElement.scrollLeft > 0) ||
(xDiff > 0 && scrollElement.clientWidth + scrollElement.scrollLeft < scrollElement.scrollWidth)) {
return;
}
}
const menuElement = hasClosestByAttribute(target, "id", "menu")
const menuElement = hasClosestByAttribute(target, "id", "menu");
if (menuElement && xDiff < 0) {
menuElement.style.right = xDiff + "px"
menuElement.style.right = xDiff + "px";
return;
}
const sideElement = hasClosestByAttribute(target, "id", "sidebar")
const sideElement = hasClosestByAttribute(target, "id", "sidebar");
if (sideElement && xDiff > 0) {
sideElement.style.left = -xDiff + "px"
sideElement.style.left = -xDiff + "px";
return;
}
console.log(event);
if (xDiff < 0) {
document.getElementById("sidebar").style.left = -window.innerWidth - xDiff + "px"
document.getElementById("sidebar").style.left = -window.innerWidth - xDiff + "px";
} else {
document.getElementById("menu").style.right = -window.innerWidth + xDiff + "px"
document.getElementById("menu").style.right = -window.innerWidth + xDiff + "px";
}
}
};

View file

@ -7,5 +7,5 @@ export const positionPDF = (pathStr: string, page: string | number) => {
tab.parent.switchTab(tab.headElement);
tab.model.goToPage(page);
}
})
}
});
};

View file

@ -146,4 +146,4 @@ new App();
// 再次点击新窗口已打开的 PDF 时,需进行定位
window.newWindow = {
positionPDF: positionPDF
}
};