This commit is contained in:
Liang Ding 2022-08-08 13:58:26 +08:00
parent b2bcec6ea0
commit effb602c62
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
9 changed files with 31 additions and 322 deletions

View file

@ -22,6 +22,7 @@ import (
"github.com/88250/gulu"
"github.com/gin-gonic/gin"
"github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util"
)
@ -56,6 +57,14 @@ func setBlockAttrs(c *gin.Context) {
id := arg["id"].(string)
attrs := arg["attrs"].(map[string]interface{})
if 1 == len(attrs) && "" != attrs["scroll"] && "dev" == util.Mode {
// 开发环境不记录用户指南滚动位置
b := treenode.GetBlockTree(id)
if nil != b && (model.IsUserGuide(b.BoxID)) {
attrs["scroll"] = ""
}
}
nameValues := map[string]string{}
for name, value := range attrs {
if nil == value { // API `setBlockAttrs` 中如果存在属性值设置为 `null` 时移除该属性 https://github.com/siyuan-note/siyuan/issues/5577