mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-17 22:25:29 +01:00
This commit is contained in:
parent
ec34dcca19
commit
0200e6eed5
12 changed files with 221 additions and 190 deletions
27
app/src/editor/deleteFile.ts
Normal file
27
app/src/editor/deleteFile.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import {fetchPost} from "../util/fetch";
|
||||
import {getDisplayName} from "../util/pathName";
|
||||
import {confirmDialog} from "../dialog/confirmDialog";
|
||||
|
||||
export const deleteFile = (notebookId: string, pathString: string, name: string) => {
|
||||
if (window.siyuan.config.fileTree.removeDocWithoutConfirm) {
|
||||
fetchPost("/api/filetree/removeDoc", {
|
||||
notebook: notebookId,
|
||||
path: pathString
|
||||
});
|
||||
return;
|
||||
}
|
||||
fetchPost("/api/block/getDocInfo", {
|
||||
id: getDisplayName(pathString, true, true)
|
||||
}, (response) => {
|
||||
let tip = `${window.siyuan.languages.confirmDelete} <b>${name}</b>?`;
|
||||
if (response.data.subFileCount > 0) {
|
||||
tip = `${window.siyuan.languages.confirmDelete} <b>${name}</b> ${window.siyuan.languages.andSubFile.replace("x", response.data.subFileCount)}?`;
|
||||
}
|
||||
confirmDialog(window.siyuan.languages.delete, tip, () => {
|
||||
fetchPost("/api/filetree/removeDoc", {
|
||||
notebook: notebookId,
|
||||
path: pathString
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue