Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/9544

Vanessac437f8df9e52
diff --git a/app/src/mobile/util/setEmpty.ts b/app/src/mobile/util/setEmpty.ts
index de535073ca..942a478b6e 100644
--- a/app/src/mobile/util/setEmpty.ts
+++ b/app/src/mobile/util/setEmpty.ts
@@ -51,26 +51,10 @@ export const setEmpty = (app: App) => {
event.preventDefault();
break;
} else if (target.id === "emptyNewFile") {
- if (window.siyuan.mobile.editor) {
- newFile({
- app,
- notebookId: window.siyuan.mobile.editor.protyle.notebookId,
- currentPath: window.siyuan.mobile.editor.protyle.path,
- useSavePath: true
- });
- } else {
- window.siyuan.notebooks.find(item => {
- if (!item.closed) {
- newFile({
- app,
- notebookId: item.id,
- currentPath: "/",
- useSavePath: true
- });
- return true;
- }
- });
- }
+ newFile({
+ app,
+ useSavePath: true
+ });
event.stopPropagation();
event.preventDefault();
break;
diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.ts
index a45a9e060a..c5913d4553 100644
--- a/app/src/util/newFile.ts
+++ b/app/src/util/newFile.ts
@@ -53,6 +53,11 @@ export const getNewFilePath = (useSavePath: boolean) => {
/// #else
if (window.siyuan.mobile.editor) {
notebookId = window.siyuan.mobile.editor.protyle.notebookId;
+ if (useSavePath) {
+ currentPath = window.siyuan.mobile.editor.protyle.path;
+ } else {
+ currentPath = pathPosix().dirname(window.siyuan.mobile.editor.protyle.path);
+ }
}
/// #endif
if (!notebookId) {