This commit is contained in:
Liang Ding 2023-01-24 13:21:23 +08:00
parent 87f230023c
commit 801bc69820
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
7 changed files with 34 additions and 18 deletions

View file

@ -89,12 +89,6 @@ export abstract class Constants {
en_US: "20210808180117-6v0mkxr", en_US: "20210808180117-6v0mkxr",
fr_FR: "20210808180117-6v0mkxr", fr_FR: "20210808180117-6v0mkxr",
}; };
public static readonly HELP_START_PATH = {
zh_CN: "20200812220555-lj3enxa",
zh_CHT: "20211226115423-d5z1joq",
en_US: "20200923234011-ieuun1p",
fr_FR: "20200923234011-ieuun1p",
};
public static readonly KEYCODE: { [key: string]: string[] } = { public static readonly KEYCODE: { [key: string]: string[] } = {
"186": [";", ":"], "186": [";", ":"],

View file

@ -12,7 +12,8 @@ import {addBaseURL, setNoteBook} from "./util/pathName";
import {openFileById} from "./editor/util"; import {openFileById} from "./editor/util";
import { import {
bootSync, bootSync,
downloadProgress, processSync, downloadProgress,
processSync,
progressLoading, progressLoading,
progressStatus, progressStatus,
setTitle, setTitle,
@ -114,6 +115,9 @@ class App {
case "createdailynote": case "createdailynote":
openFileById({id: data.data.id, action: [Constants.CB_GET_FOCUS]}); openFileById({id: data.data.id, action: [Constants.CB_GET_FOCUS]});
break; break;
case "openFileById":
openFileById({id: data.data.id, action: [Constants.CB_GET_FOCUS]});
break;
} }
} }
} }

View file

@ -734,12 +734,6 @@ export class Files extends Model {
this.element.insertAdjacentHTML("afterbegin", html); this.element.insertAdjacentHTML("afterbegin", html);
} }
} }
if (data.callback === Constants.CB_MOUNT_HELP) {
openFileById({
id: Constants.HELP_START_PATH[window.siyuan.config.appearance.lang as "zh_CN" | "en_US"],
action: [Constants.CB_GET_FOCUS]
});
}
}); });
} }

View file

@ -569,9 +569,6 @@ export class MobileFiles extends Model {
this.element.insertAdjacentHTML("afterbegin", html); this.element.insertAdjacentHTML("afterbegin", html);
} }
} }
if (data.callback === Constants.CB_MOUNT_HELP) {
openMobileFileById(Constants.HELP_START_PATH[window.siyuan.config.appearance.lang as "zh_CN" | "en_US"]);
}
}); });
} }

View file

@ -1,5 +1,7 @@
import {openMobileFileById} from "../editor"; import {openMobileFileById} from "../editor";
import {progressLoading, progressStatus, transactionError} from "../../dialog/processSystem"; import {progressLoading, progressStatus, transactionError} from "../../dialog/processSystem";
import {openFileById} from "../../editor/util";
import {Constants} from "../../constants";
export const onMessage = (data: IWebSocketData) => { export const onMessage = (data: IWebSocketData) => {
if (data) { if (data) {
@ -24,6 +26,9 @@ export const onMessage = (data: IWebSocketData) => {
case "createdailynote": case "createdailynote":
openMobileFileById(data.data.id); openMobileFileById(data.data.id);
break; break;
case "openFileById":
openMobileFileById(data.data.id, [Constants.CB_GET_FOCUS]);
break;
case"txerr": case"txerr":
transactionError(data); transactionError(data);
break; break;

View file

@ -139,7 +139,6 @@ func Mount(boxID string) (alreadyMount bool, err error) {
WaitForWritingFiles() WaitForWritingFiles()
localPath := filepath.Join(util.DataDir, boxID) localPath := filepath.Join(util.DataDir, boxID)
var reMountGuide bool var reMountGuide bool
if IsUserGuide(boxID) { if IsUserGuide(boxID) {
// 重新挂载帮助文档 // 重新挂载帮助文档
@ -200,6 +199,29 @@ func Mount(boxID string) (alreadyMount bool, err error) {
ListDocTree(box.ID, "/", Conf.FileTree.Sort) ListDocTree(box.ID, "/", Conf.FileTree.Sort)
treenode.SaveBlockTree(false) treenode.SaveBlockTree(false)
util.ClearPushProgress(100) util.ClearPushProgress(100)
if IsUserGuide(boxID) {
go func() {
var startID string
i := 0
for ; i < 70; i++ {
time.Sleep(100 * time.Millisecond)
guideStartID := map[string]string{
"20210808180117-czj9bvb": "20200812220555-lj3enxa",
"20211226090932-5lcq56f": "20211226115423-d5z1joq",
"20210808180117-6v0mkxr": "20200923234011-ieuun1p",
}
startID = guideStartID[boxID]
if nil != treenode.GetBlockTree(startID) {
util.BroadcastByType("main", "openFileById", 0, "", map[string]interface{}{
"id": startID,
})
break
}
}
}()
}
if reMountGuide { if reMountGuide {
return true, nil return true, nil
} }

View file

@ -293,7 +293,7 @@ func SetSyncGenerateConflictDoc(b bool) {
return return
} }
func SetSyncEnable(b bool) (err error) { func SetSyncEnable(b bool) {
Conf.Sync.Enabled = b Conf.Sync.Enabled = b
Conf.Save() Conf.Save()
return return