diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 18cdde9ef..e6632ee21 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -1,4 +1,5 @@ { + "currentNotebook": "Current Notebook", "containerBlockTip1": "Enabling container blocks will result in duplicate search results", "containerBlockTip2": "Enabling document blocks currently only supports searching for document titles", "copyAsPNG": "Copy as PNG", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 03c35fa34..84dafceda 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -1,4 +1,5 @@ { + "currentNotebook": "Cuaderno actual", "containerBlockTip1": "Habilitar bloques de contenedores generará resultados de búsqueda duplicados", "containerBlockTip2": "Habilitar bloques de documentos actualmente solo admite la búsqueda de títulos de documentos", "copyAsPNG": "Copiar como PNG", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 3f618327d..777ec23de 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -1,4 +1,5 @@ { + "currentNotebook": "Carnet actuel", "containerBlockTip1": "L'activation des blocs de conteneurs entraînera des résultats de recherche en double", "containerBlockTip2": "L'activation des blocs de documents ne prend actuellement en charge que la recherche de titres de documents", "copyAsPNG": "Copier en tant PNG", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 7495471f6..47487eb0a 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -1,4 +1,5 @@ { + "currentNotebook": "目前筆記本", "containerBlockTip1": "啟用容器區塊後會導致搜尋結果重複", "containerBlockTip2": "啟用文件區塊目前僅支援搜尋文件名稱", "copyAsPNG": "複製為 PNG", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 2d32ebd93..e0216d284 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -1,4 +1,5 @@ { + "currentNotebook": "当前笔记本", "containerBlockTip1": "启用容器块后会导致搜索结果重复", "containerBlockTip2": "启用文档块目前仅支持搜索文档名", "copyAsPNG": "复制为 PNG", diff --git a/app/src/config/fileTree.ts b/app/src/config/fileTree.ts index 4a93810e4..12461f93d 100644 --- a/app/src/config/fileTree.ts +++ b/app/src/config/fileTree.ts @@ -1,4 +1,5 @@ import {fetchPost} from "../util/fetch"; +import {genNotebookOption} from "../menus/onGetnotebookconf"; export const fileTree = { element: undefined as Element, @@ -51,22 +52,6 @@ export const fileTree = { -
-
- ${window.siyuan.languages.fileTree12} -
${window.siyuan.languages.fileTree13}
-
- - -
-
-
- ${window.siyuan.languages.fileTree5} -
${window.siyuan.languages.fileTree6}
-
- - -
${window.siyuan.languages.fileTree16} @@ -82,6 +67,26 @@ export const fileTree = {
+
+
+ ${window.siyuan.languages.fileTree12} +
${window.siyuan.languages.fileTree13}
+ +
+ +
+ +
+
+
+ ${window.siyuan.languages.fileTree5} +
${window.siyuan.languages.fileTree6}
+ +
+ +
+ +
`; }, _send() { @@ -100,7 +105,9 @@ export const fileTree = { sort: window.siyuan.config.fileTree.sort, alwaysSelectOpenedFile: (fileTree.element.querySelector("#alwaysSelectOpenedFile") as HTMLInputElement).checked, refCreateSavePath: (fileTree.element.querySelector("#refCreateSavePath") as HTMLInputElement).value, + refCreateSaveBox: (fileTree.element.querySelector("#refCreateSaveBox") as HTMLInputElement).value, docCreateSavePath: (fileTree.element.querySelector("#docCreateSavePath") as HTMLInputElement).value, + docCreateSaveBox: (fileTree.element.querySelector("#docCreateSaveBox") as HTMLInputElement).value, openFilesUseCurrentTab: (fileTree.element.querySelector("#openFilesUseCurrentTab") as HTMLInputElement).checked, closeTabsOnStart: (fileTree.element.querySelector("#closeTabsOnStart") as HTMLInputElement).checked, allowCreateDeeper: (fileTree.element.querySelector("#allowCreateDeeper") as HTMLInputElement).checked, @@ -115,7 +122,7 @@ export const fileTree = { bindEvent: () => { (fileTree.element.querySelector("#docCreateSavePath") as HTMLInputElement).value = window.siyuan.config.fileTree.docCreateSavePath; (fileTree.element.querySelector("#refCreateSavePath") as HTMLInputElement).value = window.siyuan.config.fileTree.refCreateSavePath; - fileTree.element.querySelectorAll("input").forEach((item) => { + fileTree.element.querySelectorAll("input, select").forEach((item) => { item.addEventListener("change", () => { fileTree._send(); }); diff --git a/app/src/menus/onGetnotebookconf.ts b/app/src/menus/onGetnotebookconf.ts index 01112e0f5..def992325 100644 --- a/app/src/menus/onGetnotebookconf.ts +++ b/app/src/menus/onGetnotebookconf.ts @@ -14,32 +14,47 @@ declare interface INotebookConf { refCreateSavePath: string docCreateSavePath: string dailyNoteSavePath: string + refCreateSaveBox: string; + docCreateSaveBox: string; dailyNoteTemplatePath: string } } +export const genNotebookOption = (id: string) => { + let html = ``; + window.siyuan.notebooks.forEach((item) => { + html += ``; + }); + return html; +} + export const onGetnotebookconf = (data: INotebookConf) => { const titleHTML = `
${escapeHtml(data.name)}
`; const contentHTML = `
-
+
${window.siyuan.languages.fileTree12} -
${window.siyuan.languages.fileTree13}
-
- + +
+ +
+ +
-
+
${window.siyuan.languages.fileTree5} -
${window.siyuan.languages.fileTree6}
-
- + +
+ +
+ +
${window.siyuan.languages.fileTree11} -
${window.siyuan.languages.fileTree14}
@@ -81,12 +96,14 @@ const bindSettingEvent = (contentElement: Element, data: INotebookConf) => { refCreateSavePathElement.value = data.conf.refCreateSavePath; const dailyNoteTemplatePathElement = contentElement.querySelector("#dailyNoteTemplatePath") as HTMLInputElement; dailyNoteTemplatePathElement.value = data.conf.dailyNoteTemplatePath; - contentElement.querySelectorAll("input").forEach((item) => { + contentElement.querySelectorAll("input, select").forEach((item) => { item.addEventListener("change", () => { fetchPost("/api/notebook/setNotebookConf", { notebook: data.box, conf: { refCreateSavePath: refCreateSavePathElement.value, + refCreateSaveBox: (contentElement.querySelector("#refCreateSaveBox") as HTMLInputElement).value, + docCreateSaveBox: (contentElement.querySelector("#docCreateSaveBox") as HTMLInputElement).value, docCreateSavePath: docCreateSavePathElement.value, dailyNoteSavePath: dailyNoteSavePathElement.value, dailyNoteTemplatePath: dailyNoteTemplatePathElement.value, diff --git a/app/src/types/config.d.ts b/app/src/types/config.d.ts index 013cf273b..7f17f5790 100644 --- a/app/src/types/config.d.ts +++ b/app/src/types/config.d.ts @@ -536,6 +536,8 @@ declare namespace Config { * The storage path of the new document created using block references */ refCreateSavePath: string; + refCreateSaveBox: string; + docCreateSaveBox: string; /** * Close the secondary confirmation when deleting a document */ diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.ts index 0d175872a..f04ef682e 100644 --- a/app/src/util/newFile.ts +++ b/app/src/util/newFile.ts @@ -95,7 +95,7 @@ export const newFile = (optios: { if ((data.data.path.indexOf("/") > -1 && optios.useSavePath) || optios.name) { if (data.data.path.startsWith("/") || optios.currentPath === "/") { fetchPost("/api/filetree/createDocWithMd", { - notebook: optios.notebookId, + notebook: data.data.box, path: pathPosix().join(data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : "")), // 根目录时无法确定 parentID markdown: "" @@ -112,11 +112,11 @@ export const newFile = (optios: { }); } else { fetchPost("/api/filetree/getHPathByPath", { - notebook: optios.notebookId, + notebook: data.data.box, path: optios.currentPath.endsWith(".sy") ? optios.currentPath : optios.currentPath + ".sy" }, (responseHPath) => { fetchPost("/api/filetree/createDocWithMd", { - notebook: optios.notebookId, + notebook: data.data.box, path: pathPosix().join(responseHPath.data, data.data.path, optios.name || (data.data.path.endsWith("/") ? window.siyuan.languages.untitled : "")), parentID: getDisplayName(optios.currentPath, true, true), markdown: "" @@ -144,7 +144,7 @@ export const newFile = (optios: { optios.paths[optios.paths.indexOf(undefined)] = newPath; } fetchPost("/api/filetree/createDoc", { - notebook: optios.notebookId, + notebook: data.data.box, path: newPath, title, md: "", @@ -169,7 +169,7 @@ export const getSavePath = (pathString: string, notebookId: string, cb: (p: stri cb(getDisplayName(data.data.path, false, true)); } else { fetchPost("/api/filetree/getHPathByPath", { - notebook: notebookId, + notebook: data.data.box, path: pathString }, (response) => { cb(getDisplayName(pathPosix().join(response.data, data.data.path), false, true)); @@ -177,7 +177,7 @@ export const getSavePath = (pathString: string, notebookId: string, cb: (p: stri } } else { fetchPost("/api/filetree/getHPathByPath", { - notebook: notebookId, + notebook: data.data.box, path: pathString }, (response) => { cb(getDisplayName(response.data, false, true));