Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	app/src/mobile/util/onMessage.ts
This commit is contained in:
Vanessa 2023-01-24 15:06:46 +08:00
commit 3fc284bda1
8 changed files with 33 additions and 25 deletions

View file

@ -89,12 +89,6 @@ export abstract class Constants {
en_US: "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[] } = {
"186": [";", ":"],

View file

@ -12,7 +12,8 @@ import {addBaseURL, setNoteBook} from "./util/pathName";
import {openFileById} from "./editor/util";
import {
bootSync,
downloadProgress, processSync,
downloadProgress,
processSync,
progressLoading,
progressStatus,
setTitle,
@ -114,6 +115,9 @@ class App {
case "createdailynote":
openFileById({id: data.data.id, action: [Constants.CB_GET_FOCUS]});
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);
}
}
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);
}
}
if (data.callback === Constants.CB_MOUNT_HELP) {
openMobileFileById(Constants.HELP_START_PATH[window.siyuan.config.appearance.lang as "zh_CN" | "en_US"]);
}
});
}

View file

@ -17,6 +17,9 @@ export const onMessage = (data: IWebSocketData) => {
case "createdailynote":
openMobileFileById(data.data.id);
break;
case "openFileById":
openMobileFileById(data.data.id, [Constants.CB_GET_FOCUS]);
break;
case"txerr":
transactionError(data);
break;

View file

@ -149,13 +149,7 @@ func setSyncEnable(c *gin.Context) {
}
enabled := arg["enabled"].(bool)
err := model.SetSyncEnable(enabled)
if nil != err {
ret.Code = 1
ret.Msg = err.Error()
ret.Data = map[string]interface{}{"closeTimeout": 5000}
return
}
model.SetSyncEnable(enabled)
}
func setSyncMode(c *gin.Context) {

View file

@ -139,7 +139,6 @@ func Mount(boxID string) (alreadyMount bool, err error) {
WaitForWritingFiles()
localPath := filepath.Join(util.DataDir, boxID)
var reMountGuide bool
if IsUserGuide(boxID) {
// 重新挂载帮助文档
@ -200,6 +199,29 @@ func Mount(boxID string) (alreadyMount bool, err error) {
ListDocTree(box.ID, "/", Conf.FileTree.Sort)
treenode.SaveBlockTree(false)
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 {
return true, nil
}

View file

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