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

This commit is contained in:
Vanessa
2026-04-09 16:27:45 +08:00
2 changed files with 36 additions and 2 deletions

View File

@@ -485,7 +485,13 @@ func renameFile(c *gin.Context) {
return
}
srcPath := arg["path"].(string)
var srcPath string
if !util.ParseJsonArgs(arg, ret,
util.BindJsonArg("path", &srcPath, true, true),
) {
return
}
srcAbsPath, err := util.GetAbsPathInWorkspace(srcPath)
if err != nil {
ret.Code = http.StatusForbidden
@@ -532,7 +538,13 @@ func removeFile(c *gin.Context) {
return
}
filePath := arg["path"].(string)
var filePath string
if !util.ParseJsonArgs(arg, ret,
util.BindJsonArg("path", &filePath, true, true),
) {
return
}
fileAbsPath, err := util.GetAbsPathInWorkspace(filePath)
if err != nil {
ret.Code = http.StatusForbidden

View File

@@ -162,6 +162,17 @@ func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATi
lastSpace := false
ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering {
if ast.NodeTable == n.Type {
caption := n.IALAttr("caption")
if "" != caption {
caption = html.UnescapeHTMLStr(caption)
if strings.Contains(caption, "caption-side:") && strings.Contains(caption, "bottom") {
caption = gulu.Str.SubStringBetween(caption, ">", "<")
buf.WriteByte(' ')
buf.WriteString(caption)
}
}
}
return ast.WalkContinue
}
@@ -196,6 +207,17 @@ func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATi
}
switch n.Type {
case ast.NodeTable:
caption := n.IALAttr("caption")
if "" != caption {
caption = html.UnescapeHTMLStr(caption)
if strings.Contains(caption, "caption-side:") && strings.Contains(caption, "bottom") {
return ast.WalkContinue
}
caption = gulu.Str.SubStringBetween(caption, ">", "<")
buf.WriteString(caption)
buf.WriteByte(' ')
}
case ast.NodeTableCell:
// 表格块写入数据库表时在单元格之间添加空格 https://github.com/siyuan-note/siyuan/issues/7654
if 0 < buf.Len() && ' ' != buf.Bytes()[buf.Len()-1] {