This commit is contained in:
Vanessa 2023-04-25 10:57:14 +08:00
parent 4946121b01
commit 2494412f77
6 changed files with 10 additions and 10 deletions

View file

@ -230,11 +230,11 @@ const renderRepo = (element: Element, currentPage: number) => {
}); });
previousElement.classList.add("fn__none"); previousElement.classList.add("fn__none");
nextElement.classList.add("fn__none"); nextElement.classList.add("fn__none");
pageElement.classList.add("fn__none") pageElement.classList.add("fn__none");
} else { } else {
previousElement.classList.remove("fn__none"); previousElement.classList.remove("fn__none");
nextElement.classList.remove("fn__none"); nextElement.classList.remove("fn__none");
pageElement.classList.remove("fn__none") pageElement.classList.remove("fn__none");
element.setAttribute("data-page", currentPage.toString()); element.setAttribute("data-page", currentPage.toString());
if (currentPage > 1) { if (currentPage > 1) {
previousElement.removeAttribute("disabled"); previousElement.removeAttribute("disabled");
@ -514,7 +514,7 @@ const bindEvent = (element: Element, dialog?: Dialog) => {
} else if (type === "more") { } else if (type === "more") {
target.parentElement.parentElement.querySelectorAll(".b3-list-item__meta").forEach(item => { target.parentElement.parentElement.querySelectorAll(".b3-list-item__meta").forEach(item => {
item.classList.toggle("fn__none"); item.classList.toggle("fn__none");
}) });
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
break; break;

View file

@ -89,7 +89,7 @@ export class Bookmark extends Model {
} }
}, },
rightClick: (element: HTMLElement, event: MouseEvent) => { rightClick: (element: HTMLElement, event: MouseEvent) => {
openBookmarkMenu(element, event, this) openBookmarkMenu(element, event, this);
}, },
ctrlClick(element: HTMLElement) { ctrlClick(element: HTMLElement) {
openFileById({ openFileById({

View file

@ -63,7 +63,7 @@ export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookma
confirmDialog(window.siyuan.languages.deleteOpConfirm, `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(bookmarkText)}</b>?`, () => { confirmDialog(window.siyuan.languages.deleteOpConfirm, `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(bookmarkText)}</b>?`, () => {
if (id) { if (id) {
fetchPost("/api/attr/setBlockAttrs", {id, attrs: {bookmark: ""}}, () => { fetchPost("/api/attr/setBlockAttrs", {id, attrs: {bookmark: ""}}, () => {
bookmarkObj.update() bookmarkObj.update();
}); });
document.querySelectorAll(`.protyle-wysiwyg [data-node-id="${id}"]`).forEach((item) => { document.querySelectorAll(`.protyle-wysiwyg [data-node-id="${id}"]`).forEach((item) => {
item.setAttribute("bookmark", ""); item.setAttribute("bookmark", "");
@ -81,4 +81,4 @@ export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookma
} }
window.siyuan.menus.menu.element.style.zIndex = "221"; // 移动端被右侧栏遮挡 window.siyuan.menus.menu.element.style.zIndex = "221"; // 移动端被右侧栏遮挡
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY}); window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});
} };

View file

@ -402,7 +402,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
icon: "iconSearch", icon: "iconSearch",
accelerator: window.siyuan.config.keymap.general.search.custom, accelerator: window.siyuan.config.keymap.general.search.custom,
async click() { async click() {
const searchPath = getDisplayName(pathString, false, true) const searchPath = getDisplayName(pathString, false, true);
/// #if MOBILE /// #if MOBILE
const response = await fetchSyncPost("/api/filetree/getHPathByPath", { const response = await fetchSyncPost("/api/filetree/getHPathByPath", {
notebook: notebookId, notebook: notebookId,
@ -432,7 +432,7 @@ export const initFileMenu = (notebookId: string, pathString: string, liElement:
accelerator: window.siyuan.config.keymap.general.replace.custom, accelerator: window.siyuan.config.keymap.general.replace.custom,
icon: "iconReplace", icon: "iconReplace",
async click() { async click() {
const searchPath = getDisplayName(pathString, false, true) const searchPath = getDisplayName(pathString, false, true);
/// #if MOBILE /// #if MOBILE
const response = await fetchSyncPost("/api/filetree/getHPathByPath", { const response = await fetchSyncPost("/api/filetree/getHPathByPath", {
notebook: notebookId, notebook: notebookId,

View file

@ -32,7 +32,7 @@ export class MobileBookmarks {
const id = element.getAttribute("data-node-id"); const id = element.getAttribute("data-node-id");
const actionElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item__action"); const actionElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item__action");
if (actionElement) { if (actionElement) {
openBookmarkMenu(actionElement.parentElement, event, this) openBookmarkMenu(actionElement.parentElement, event, this);
} else { } else {
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => { fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
openMobileFileById(id, foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML]); openMobileFileById(id, foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML]);

View file

@ -1,5 +1,5 @@
// https://github.com/siyuan-note/siyuan/pull/8012 // https://github.com/siyuan-note/siyuan/pull/8012
export const registerServiceWorker = (scriptURL: string, scope: string = "/", workerType: WorkerType = "module") => { export const registerServiceWorker = (scriptURL: string, scope = "/", workerType: WorkerType = "module") => {
if (!("serviceWorker" in navigator) || typeof (navigator.serviceWorker) === "undefined" || if (!("serviceWorker" in navigator) || typeof (navigator.serviceWorker) === "undefined" ||
!("caches" in window) || !("fetch" in window)) { !("caches" in window) || !("fetch" in window)) {
return; return;