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

This commit is contained in:
Vanessa 2023-02-12 23:03:41 +08:00
commit ea6e9e4ada
3 changed files with 38 additions and 0 deletions

View file

@ -46,6 +46,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/system/setNetworkProxy", model.CheckAuth, setNetworkProxy)
ginServer.Handle("POST", "/api/system/setWorkspaceDir", model.CheckAuth, setWorkspaceDir)
ginServer.Handle("POST", "/api/system/getWorkspaces", model.CheckAuth, getWorkspaces)
ginServer.Handle("POST", "/api/system/getMobileWorkspaces", model.CheckAuth, getMobileWorkspaces)
ginServer.Handle("POST", "/api/system/createWorkspaceDir", model.CheckAuth, createWorkspaceDir)
ginServer.Handle("POST", "/api/system/removeWorkspaceDir", model.CheckAuth, removeWorkspaceDir)
ginServer.Handle("POST", "/api/system/setAppearanceMode", model.CheckAuth, setAppearanceMode)

View file

@ -117,6 +117,36 @@ type Workspace struct {
Closed bool `json:"closed"`
}
func getMobileWorkspaces(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
if util.ContainerIOS != util.Container && util.ContainerAndroid != util.Container {
return
}
root := filepath.Dir(util.WorkspaceDir)
dirs, err := os.ReadDir(root)
if nil != err {
logging.LogErrorf("read dir [%s] failed: %s", root, err)
ret.Code = -1
ret.Msg = err.Error()
return
}
var names []string
for _, dir := range dirs {
if dir.IsDir() {
if isInvalidWorkspacePath(filepath.Join(root, dir.Name())) {
continue
}
names = append(names, dir.Name())
}
}
ret.Data = names
}
func getWorkspaces(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)

View file

@ -225,6 +225,13 @@ func NodeStaticContent(node *ast.Node, excludeTypes []string) string {
if n.IsTextMarkType("tag") {
buf.WriteByte('#')
}
if n.IsTextMarkType("a") {
// 搜索不到超链接元素的 URL 和标题 https://github.com/siyuan-note/siyuan/issues/7352
if "" != n.TextMarkATitle {
buf.WriteString(" " + n.TextMarkATitle)
}
buf.WriteString(" " + n.TextMarkAHref)
}
case ast.NodeBackslash:
buf.WriteByte(lex.ItemBackslash)
case ast.NodeBackslashContent: