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

View file

@ -85,7 +85,7 @@ func ListNotebooks() (ret []*Box, err error) {
boxConf := conf.NewBoxConf()
boxConfPath := filepath.Join(util.DataDir, dir.Name(), ".siyuan", "conf.json")
if !gulu.File.IsExist(boxConfPath) {
if isUserGuide(dir.Name()) {
if IsUserGuide(dir.Name()) {
filelock.ReleaseAllFileLocks()
os.RemoveAll(filepath.Join(util.DataDir, dir.Name()))
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)
if !isUserGuide(boxID) {
if !IsUserGuide(boxID) {
var historyDir string
historyDir, err = util.GetHistoryDir("delete")
if nil != err {
@ -148,7 +148,7 @@ func Mount(boxID string) (alreadyMount bool, err error) {
localPath := filepath.Join(util.DataDir, boxID)
var reMountGuide bool
if isUserGuide(boxID) {
if IsUserGuide(boxID) {
// 重新挂载帮助文档
guideBox := Conf.Box(boxID)
@ -214,6 +214,6 @@ func Mount(boxID string) (alreadyMount bool, err error) {
return false, nil
}
func isUserGuide(boxID string) bool {
func IsUserGuide(boxID string) bool {
return "20210808180117-czj9bvb" == boxID || "20210808180117-6v0mkxr" == boxID || "20211226090932-5lcq56f" == boxID
}