This commit is contained in:
parent
1d142c9df1
commit
f2a53014fb
16 changed files with 32 additions and 18 deletions
|
@ -224,6 +224,14 @@
|
|||
color: var(--b3-theme-primary);
|
||||
}
|
||||
|
||||
&--remove:hover {
|
||||
color: var(--b3-card-error-color);
|
||||
|
||||
& > .b3-menu__icon {
|
||||
color: var(--b3-card-error-color);
|
||||
}
|
||||
}
|
||||
|
||||
&--current:not(.b3-menu__item--readonly) {
|
||||
background-color: var(--b3-list-hover);
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ export const makeCard = (app: App, ids: string[]) => {
|
|||
}, () => {
|
||||
target.parentElement.remove();
|
||||
});
|
||||
});
|
||||
}, undefined, true);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
break;
|
||||
|
|
|
@ -68,7 +68,7 @@ export const image = {
|
|||
assetsListElement.innerHTML = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;
|
||||
image.element.querySelector(".config-assets__preview").innerHTML = "";
|
||||
});
|
||||
});
|
||||
}, undefined, true);
|
||||
} else if (target.classList.contains("item") && !target.classList.contains("item--focus")) {
|
||||
image.element.querySelector(".layout-tab-bar .item--focus").classList.remove("item--focus");
|
||||
target.classList.add("item--focus");
|
||||
|
@ -113,7 +113,7 @@ export const image = {
|
|||
}
|
||||
image.element.querySelector(".config-assets__preview").innerHTML = "";
|
||||
});
|
||||
});
|
||||
}, undefined, true);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import {isMobile} from "../util/functions";
|
||||
import {Dialog} from "./index";
|
||||
|
||||
export const confirmDialog = (title: string, text: string, confirm?: (dialog?: Dialog) => void, cancel?: (dialog: Dialog) => void) => {
|
||||
export const confirmDialog = (title: string, text: string,
|
||||
confirm?: (dialog?: Dialog) => void,
|
||||
cancel?: (dialog: Dialog) => void,
|
||||
isDelete = false) => {
|
||||
if (!text && !title) {
|
||||
confirm();
|
||||
return;
|
||||
|
@ -13,7 +16,7 @@ export const confirmDialog = (title: string, text: string, confirm?: (dialog?: D
|
|||
</div>
|
||||
<div class="b3-dialog__action">
|
||||
<button class="b3-button b3-button--cancel">${window.siyuan.languages.cancel}</button><div class="fn__space"></div>
|
||||
<button class="b3-button b3-button--text" id="confirmDialogConfirmBtn">${window.siyuan.languages.confirm}</button>
|
||||
<button class="b3-button ${isDelete ? "b3-button--remove" : "b3-button--text"}" id="confirmDialogConfirmBtn">${window.siyuan.languages[isDelete ? "delete" : "confirm"]}</button>
|
||||
</div>`,
|
||||
width: isMobile() ? "92vw" : "520px",
|
||||
});
|
||||
|
|
|
@ -31,7 +31,7 @@ export const deleteFile = (notebookId: string, pathString: string) => {
|
|||
notebook: notebookId,
|
||||
path: pathString
|
||||
});
|
||||
});
|
||||
}, undefined, true);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -51,7 +51,7 @@ export const deleteFiles = (liElements: Element[]) => {
|
|||
notebook: itemNotebookId,
|
||||
callback: Constants.CB_MOUNT_REMOVE
|
||||
});
|
||||
});
|
||||
}, undefined, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -73,6 +73,6 @@ export const deleteFiles = (liElements: Element[]) => {
|
|||
fetchPost("/api/filetree/removeDocs", {
|
||||
paths
|
||||
});
|
||||
});
|
||||
}, undefined, true);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -759,7 +759,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
|
|||
fetchPost("/api/repo/" + type, {tag}, () => {
|
||||
renderRepo(repoElement, 1);
|
||||
});
|
||||
});
|
||||
}, undefined, true);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
break;
|
||||
|
|
|
@ -165,7 +165,7 @@ export class Files extends Model {
|
|||
notebook: target.getAttribute("data-url"),
|
||||
callback: Constants.CB_MOUNT_REMOVE
|
||||
});
|
||||
});
|
||||
}, undefined, true);
|
||||
window.siyuan.menus.menu.remove();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
|
|
@ -290,7 +290,7 @@ ${data.shorthandContent}
|
|||
} else {
|
||||
this.remove(detailsElement.getAttribute("data-id"));
|
||||
}
|
||||
});
|
||||
}, undefined, true);
|
||||
}
|
||||
}).element);
|
||||
}
|
||||
|
|
|
@ -213,6 +213,9 @@ export class MenuItem {
|
|||
if (options.type === "readonly") {
|
||||
this.element.classList.add("b3-menu__item--readonly");
|
||||
}
|
||||
if (options.icon === "iconTrashcan") {
|
||||
this.element.classList.add("b3-menu__item--remove");
|
||||
}
|
||||
|
||||
if (options.element) {
|
||||
this.element.append(options.element);
|
||||
|
|
|
@ -85,7 +85,7 @@ export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookma
|
|||
} else {
|
||||
fetchPost("/api/bookmark/removeBookmark", {bookmark: bookmarkText});
|
||||
}
|
||||
});
|
||||
}, undefined, true);
|
||||
}
|
||||
}).element);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ export const openTagMenu = (element: HTMLElement, event: MouseEvent, labelName:
|
|||
click: () => {
|
||||
confirmDialog(window.siyuan.languages.deleteOpConfirm, `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(labelName)}</b>?`, () => {
|
||||
fetchPost("/api/tag/removeTag", {label: labelName});
|
||||
});
|
||||
}, undefined, true);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.element.setAttribute("data-name", "tagMenu");
|
||||
|
|
|
@ -301,7 +301,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {
|
|||
fetchPost("/api/system/removeWorkspaceDir", {path: item.path}, () => {
|
||||
confirmDialog(window.siyuan.languages.deleteOpConfirm, window.siyuan.languages.removeWorkspacePhysically.replace("${x}", item.path), () => {
|
||||
fetchPost("/api/system/removeWorkspaceDirPhysically", {path: item.path});
|
||||
});
|
||||
}, undefined, true);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ export class MobileFiles extends Model {
|
|||
notebook: target.getAttribute("data-url"),
|
||||
callback: Constants.CB_MOUNT_REMOVE
|
||||
});
|
||||
});
|
||||
}, undefined, true);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
break;
|
||||
|
|
|
@ -356,7 +356,7 @@ export const initAbout = () => {
|
|||
genWorkspace(workspaceDirElement);
|
||||
confirmDialog(window.siyuan.languages.deleteOpConfirm, window.siyuan.languages.removeWorkspacePhysically.replace("${x}", removePath), () => {
|
||||
fetchPost("/api/system/removeWorkspaceDirPhysically", {path: removePath});
|
||||
});
|
||||
}, undefined, true);
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
|
@ -289,7 +289,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement,
|
|||
if (selectedElement) {
|
||||
menuElement.querySelector(".b3-menu__items").scrollTop = oldScroll + (menuElement.querySelector(".b3-chips").clientHeight - oldChipsHeight);
|
||||
}
|
||||
});
|
||||
}, undefined, true);
|
||||
}
|
||||
});
|
||||
menu.addSeparator();
|
||||
|
|
|
@ -61,7 +61,7 @@ export const bindSyncCloudListEvent = (cloudPanelElement: Element, cb?: () => vo
|
|||
window.siyuan.config.sync.cloudName = response.data;
|
||||
getSyncCloudList(cloudPanelElement, true, cb);
|
||||
});
|
||||
});
|
||||
}, undefined, true);
|
||||
break;
|
||||
case "selectCloud":
|
||||
cloudPanelElement.innerHTML = '<img style="margin: 0 auto;display: block;width: 64px;height: 100%" src="/stage/loading-pure.svg">';
|
||||
|
|
Loading…
Add table
Reference in a new issue