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

@ -6,7 +6,7 @@
"id": "20200923234731-h3zkwm2", "id": "20200923234731-h3zkwm2",
"title": "FAQ", "title": "FAQ",
"type": "doc", "type": "doc",
"updated": "20220711123705" "updated": "20220808132857"
}, },
"Children": [ "Children": [
{ {
@ -704,7 +704,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20220526112843-xbvl2ni", "id": "20220526112843-xbvl2ni",
"updated": "20220615152228" "updated": "20220808132857"
}, },
"Children": [ "Children": [
{ {
@ -846,7 +846,7 @@
}, },
"Properties": { "Properties": {
"id": "20220526112843-rnr85gt", "id": "20220526112843-rnr85gt",
"updated": "20220526112843" "updated": "20220808132857"
}, },
"Children": [ "Children": [
{ {
@ -854,39 +854,9 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20220526112843-mj4iy0b", "id": "20220526112843-mj4iy0b",
"updated": "20220615152201" "updated": "20220808132857"
}, },
"Children": [ "Children": [
{
"Type": "NodeLink",
"Data": "span",
"Children": [
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText",
"Data": "Data Parser"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "https://github.com/88250/protyle"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeText",
"Data": " and "
},
{ {
"Type": "NodeLink", "Type": "NodeLink",
"Data": "span", "Data": "span",

View file

@ -6,7 +6,7 @@
"id": "20201121224345-rc27qvo", "id": "20201121224345-rc27qvo",
"title": "Acknowledgements", "title": "Acknowledgements",
"type": "doc", "type": "doc",
"updated": "20220716105832" "updated": "20220522101213"
}, },
"Children": [ "Children": [
{ {
@ -29,7 +29,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20220522101213-z3hokh2", "id": "20220522101213-z3hokh2",
"updated": "20220716105832" "updated": "20220522101213"
}, },
"Children": [ "Children": [
{ {
@ -592,76 +592,6 @@
} }
] ]
}, },
{
"ID": "20220522101213-yje0526",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220522101213-yje0526",
"updated": "20220522101213"
},
"Children": [
{
"ID": "20220522101213-523nxnk",
"Type": "NodeParagraph",
"Properties": {
"id": "20220522101213-523nxnk",
"updated": "20220522101213"
},
"Children": [
{
"Type": "NodeLink",
"Data": "span",
"Children": [
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText",
"Data": "https://github.com/88250/protyle"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "https://github.com/88250/protyle"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeText",
"Data": " "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "Mulan PSL v2"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
}
]
}
]
},
{ {
"ID": "20220522101213-7w3dt83", "ID": "20220522101213-7w3dt83",
"Type": "NodeListItem", "Type": "NodeListItem",

View file

@ -6,7 +6,7 @@
"id": "20200813093015-u6bopdt", "id": "20200813093015-u6bopdt",
"title": "常见问题", "title": "常见问题",
"type": "doc", "type": "doc",
"updated": "20220711123431" "updated": "20220808132829"
}, },
"Children": [ "Children": [
{ {
@ -802,7 +802,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20220526112824-mw30a1z", "id": "20220526112824-mw30a1z",
"updated": "20220615151956" "updated": "20220808132829"
}, },
"Children": [ "Children": [
{ {
@ -944,7 +944,7 @@
}, },
"Properties": { "Properties": {
"id": "20220526112824-w23ystc", "id": "20220526112824-w23ystc",
"updated": "20220526112824" "updated": "20220808132829"
}, },
"Children": [ "Children": [
{ {
@ -952,39 +952,9 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20220526112824-8p1ws46", "id": "20220526112824-8p1ws46",
"updated": "20220615151918" "updated": "20220808132829"
}, },
"Children": [ "Children": [
{
"Type": "NodeLink",
"Data": "span",
"Children": [
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText",
"Data": "数据解析器"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "https://github.com/88250/protyle"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeText",
"Data": "和"
},
{ {
"Type": "NodeLink", "Type": "NodeLink",
"Data": "span", "Data": "span",

View file

@ -6,7 +6,7 @@
"id": "20201121212605-9td1a62", "id": "20201121212605-9td1a62",
"title": "致谢", "title": "致谢",
"type": "doc", "type": "doc",
"updated": "20220716105842" "updated": "20220522101224"
}, },
"Children": [ "Children": [
{ {
@ -29,7 +29,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20220522101224-ctmcj3d", "id": "20220522101224-ctmcj3d",
"updated": "20220716105842" "updated": "20220522101224"
}, },
"Children": [ "Children": [
{ {
@ -592,76 +592,6 @@
} }
] ]
}, },
{
"ID": "20220522101224-sadobhd",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220522101224-sadobhd",
"updated": "20220522101224"
},
"Children": [
{
"ID": "20220522101224-yzy9201",
"Type": "NodeParagraph",
"Properties": {
"id": "20220522101224-yzy9201",
"updated": "20220522101224"
},
"Children": [
{
"Type": "NodeLink",
"Data": "span",
"Children": [
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText",
"Data": "https://github.com/88250/protyle"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "https://github.com/88250/protyle"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeText",
"Data": " "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "Mulan PSL v2"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
}
]
}
]
},
{ {
"ID": "20220522101224-2z5veif", "ID": "20220522101224-2z5veif",
"Type": "NodeListItem", "Type": "NodeListItem",

View file

@ -5,7 +5,7 @@
"icon": "1f64f", "icon": "1f64f",
"id": "20211226114929-08ap1r0", "id": "20211226114929-08ap1r0",
"title": "致謝", "title": "致謝",
"updated": "20220716105852" "updated": "20220326092650"
}, },
"Children": [ "Children": [
{ {
@ -28,7 +28,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20220326092650-r61gazd", "id": "20220326092650-r61gazd",
"updated": "20220716105852" "updated": "20220326092650"
}, },
"Children": [ "Children": [
{ {
@ -591,76 +591,6 @@
} }
] ]
}, },
{
"ID": "20220326092650-tl3kn7t",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220326092650-tl3kn7t",
"updated": "20220326092650"
},
"Children": [
{
"ID": "20220326092650-u4hhbgb",
"Type": "NodeParagraph",
"Properties": {
"id": "20220326092650-u4hhbgb",
"updated": "20220326092650"
},
"Children": [
{
"Type": "NodeLink",
"Data": "span",
"Children": [
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText",
"Data": "https://github.com/88250/protyle"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "https://github.com/88250/protyle"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeText",
"Data": " "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "Mulan PSL v2"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
}
]
}
]
},
{ {
"ID": "20220326092650-s3miqvl", "ID": "20220326092650-s3miqvl",
"Type": "NodeListItem", "Type": "NodeListItem",

View file

@ -5,7 +5,7 @@
"icon": "2753", "icon": "2753",
"id": "20211226115227-r1rty9v", "id": "20211226115227-r1rty9v",
"title": "常見問題", "title": "常見問題",
"updated": "20220711123511" "updated": "20220808132844"
}, },
"Children": [ "Children": [
{ {
@ -700,7 +700,7 @@
"ListData": {}, "ListData": {},
"Properties": { "Properties": {
"id": "20220526112905-4lumsx2", "id": "20220526112905-4lumsx2",
"updated": "20220615152136" "updated": "20220808132844"
}, },
"Children": [ "Children": [
{ {
@ -842,7 +842,7 @@
}, },
"Properties": { "Properties": {
"id": "20220526112905-25zib8i", "id": "20220526112905-25zib8i",
"updated": "20220526112905" "updated": "20220808132844"
}, },
"Children": [ "Children": [
{ {
@ -850,39 +850,9 @@
"Type": "NodeParagraph", "Type": "NodeParagraph",
"Properties": { "Properties": {
"id": "20220526112905-lg3tfv2", "id": "20220526112905-lg3tfv2",
"updated": "20220615152035" "updated": "20220808132844"
}, },
"Children": [ "Children": [
{
"Type": "NodeLink",
"Data": "span",
"Children": [
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText",
"Data": "數據解析器"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "https://github.com/88250/protyle"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeText",
"Data": "和"
},
{ {
"Type": "NodeLink", "Type": "NodeLink",
"Data": "span", "Data": "span",

View file

@ -22,6 +22,7 @@ import (
"github.com/88250/gulu" "github.com/88250/gulu"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/siyuan-note/siyuan/kernel/model" "github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util" "github.com/siyuan-note/siyuan/kernel/util"
) )
@ -56,6 +57,14 @@ func setBlockAttrs(c *gin.Context) {
id := arg["id"].(string) id := arg["id"].(string)
attrs := arg["attrs"].(map[string]interface{}) 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{} nameValues := map[string]string{}
for name, value := range attrs { for name, value := range attrs {
if nil == value { // API `setBlockAttrs` 中如果存在属性值设置为 `null` 时移除该属性 https://github.com/siyuan-note/siyuan/issues/5577 if nil == value { // API `setBlockAttrs` 中如果存在属性值设置为 `null` 时移除该属性 https://github.com/siyuan-note/siyuan/issues/5577

View file

@ -85,7 +85,7 @@ func ListNotebooks() (ret []*Box, err error) {
boxConf := conf.NewBoxConf() boxConf := conf.NewBoxConf()
boxConfPath := filepath.Join(util.DataDir, dir.Name(), ".siyuan", "conf.json") boxConfPath := filepath.Join(util.DataDir, dir.Name(), ".siyuan", "conf.json")
if !gulu.File.IsExist(boxConfPath) { if !gulu.File.IsExist(boxConfPath) {
if isUserGuide(dir.Name()) { if IsUserGuide(dir.Name()) {
filelock.ReleaseAllFileLocks() filelock.ReleaseAllFileLocks()
os.RemoveAll(filepath.Join(util.DataDir, dir.Name())) os.RemoveAll(filepath.Join(util.DataDir, dir.Name()))
logging.LogWarnf("not found user guid box conf [%s], removed it", boxConfPath) logging.LogWarnf("not found user guid box conf [%s], removed it", boxConfPath)

View file

@ -89,7 +89,7 @@ func RemoveBox(boxID string) (err error) {
} }
filelock.ReleaseFileLocks(localPath) filelock.ReleaseFileLocks(localPath)
if !isUserGuide(boxID) { if !IsUserGuide(boxID) {
var historyDir string var historyDir string
historyDir, err = util.GetHistoryDir("delete") historyDir, err = util.GetHistoryDir("delete")
if nil != err { if nil != err {
@ -148,7 +148,7 @@ func Mount(boxID string) (alreadyMount bool, err error) {
localPath := filepath.Join(util.DataDir, boxID) localPath := filepath.Join(util.DataDir, boxID)
var reMountGuide bool var reMountGuide bool
if isUserGuide(boxID) { if IsUserGuide(boxID) {
// 重新挂载帮助文档 // 重新挂载帮助文档
guideBox := Conf.Box(boxID) guideBox := Conf.Box(boxID)
@ -214,6 +214,6 @@ func Mount(boxID string) (alreadyMount bool, err error) {
return false, nil return false, nil
} }
func isUserGuide(boxID string) bool { func IsUserGuide(boxID string) bool {
return "20210808180117-czj9bvb" == boxID || "20210808180117-6v0mkxr" == boxID || "20211226090932-5lcq56f" == boxID return "20210808180117-czj9bvb" == boxID || "20210808180117-6v0mkxr" == boxID || "20211226090932-5lcq56f" == boxID
} }