mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Backlink and backmention sort mode persistence (#16291)
fix https://github.com/siyuan-note/siyuan/issues/7764
This commit is contained in:
parent
f45f2c7cdb
commit
d14501178d
5 changed files with 46 additions and 15 deletions
|
|
@ -52,6 +52,8 @@ type Editor struct {
|
|||
BacklinkExpandCount int `json:"backlinkExpandCount"` // 反向链接默认展开数量
|
||||
BackmentionExpandCount int `json:"backmentionExpandCount"` // 反链提及默认展开数量
|
||||
BacklinkContainChildren bool `json:"backlinkContainChildren"` // 反向链接是否包含子块进行计算
|
||||
BacklinkSort *int `json:"backlinkSort"` // 反向链接排序方式
|
||||
BackmentionSort *int `json:"backmentionSort"` // 反链提及排序方式
|
||||
HeadingEmbedMode int `json:"headingEmbedMode"` // 标题嵌入块模式,0:显示标题与下方的块,1:仅显示标题,2:仅显示标题下方的块
|
||||
Markdown *util.Markdown `json:"markdown"` // Markdown 配置
|
||||
}
|
||||
|
|
@ -89,6 +91,8 @@ func NewEditor() *Editor {
|
|||
BacklinkExpandCount: 8,
|
||||
BackmentionExpandCount: -1,
|
||||
BacklinkContainChildren: true,
|
||||
BacklinkSort: func() *int { v := util.SortModeUpdatedDESC; return &v }(),
|
||||
BackmentionSort: func() *int { v := util.SortModeUpdatedDESC; return &v }(),
|
||||
HeadingEmbedMode: 0,
|
||||
Markdown: util.MarkdownSettings,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,8 +229,17 @@ func InitConf() {
|
|||
Conf.Tag = conf.NewTag()
|
||||
}
|
||||
|
||||
defaultEditor := conf.NewEditor()
|
||||
if nil == Conf.Editor {
|
||||
Conf.Editor = conf.NewEditor()
|
||||
Conf.Editor = defaultEditor
|
||||
}
|
||||
// 新增字段的默认值
|
||||
// 使用指针类型来区分字段不存在(nil)和用户设置为 0(非 nil)
|
||||
if nil == Conf.Editor.BacklinkSort {
|
||||
Conf.Editor.BacklinkSort = defaultEditor.BacklinkSort
|
||||
}
|
||||
if nil == Conf.Editor.BackmentionSort {
|
||||
Conf.Editor.BackmentionSort = defaultEditor.BackmentionSort
|
||||
}
|
||||
if 1 > len(Conf.Editor.Emoji) {
|
||||
Conf.Editor.Emoji = []string{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue