mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-04 06:31:47 +01:00
🎨 表 blocks 新增 fmarkdown 字段 https://github.com/siyuan-note/siyuan/issues/5720
This commit is contained in:
parent
04e7a931f3
commit
8391638731
8 changed files with 103 additions and 96 deletions
|
|
@ -25,31 +25,32 @@ import (
|
|||
|
||||
// Block 描述了内容块。
|
||||
type Block struct {
|
||||
Box string `json:"box"`
|
||||
Path string `json:"path"`
|
||||
HPath string `json:"hPath"`
|
||||
ID string `json:"id"`
|
||||
RootID string `json:"rootID"`
|
||||
ParentID string `json:"parentID"`
|
||||
Name string `json:"name"`
|
||||
Alias string `json:"alias"`
|
||||
Memo string `json:"memo"`
|
||||
Tag string `json:"tag"`
|
||||
Content string `json:"content"`
|
||||
FContent string `json:"fcontent"`
|
||||
Markdown string `json:"markdown"`
|
||||
Folded bool `json:"folded"`
|
||||
Type string `json:"type"`
|
||||
SubType string `json:"subType"`
|
||||
RefText string `json:"refText"`
|
||||
Defs []*Block `json:"-"` // 当前块引用了这些块,避免序列化 JSON 时产生循环引用
|
||||
Refs []*Block `json:"refs"` // 当前块被这些块引用
|
||||
DefID string `json:"defID"`
|
||||
DefPath string `json:"defPath"`
|
||||
IAL map[string]string `json:"ial"`
|
||||
Children []*Block `json:"children"`
|
||||
Depth int `json:"depth"`
|
||||
Count int `json:"count"`
|
||||
Box string `json:"box"`
|
||||
Path string `json:"path"`
|
||||
HPath string `json:"hPath"`
|
||||
ID string `json:"id"`
|
||||
RootID string `json:"rootID"`
|
||||
ParentID string `json:"parentID"`
|
||||
Name string `json:"name"`
|
||||
Alias string `json:"alias"`
|
||||
Memo string `json:"memo"`
|
||||
Tag string `json:"tag"`
|
||||
Content string `json:"content"`
|
||||
FContent string `json:"fcontent"`
|
||||
Markdown string `json:"markdown"`
|
||||
FMarkdown string `json:"fmarkdown"`
|
||||
Folded bool `json:"folded"`
|
||||
Type string `json:"type"`
|
||||
SubType string `json:"subType"`
|
||||
RefText string `json:"refText"`
|
||||
Defs []*Block `json:"-"` // 当前块引用了这些块,避免序列化 JSON 时产生循环引用
|
||||
Refs []*Block `json:"refs"` // 当前块被这些块引用
|
||||
DefID string `json:"defID"`
|
||||
DefPath string `json:"defPath"`
|
||||
IAL map[string]string `json:"ial"`
|
||||
Children []*Block `json:"children"`
|
||||
Depth int `json:"depth"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
func (block *Block) IsContainerBlock() bool {
|
||||
|
|
|
|||
|
|
@ -486,24 +486,25 @@ func fromSQLBlock(sqlBlock *sql.Block, terms string, beforeLen int) (block *Bloc
|
|||
p := sqlBlock.Path
|
||||
|
||||
content, _ = markSearch(content, terms, beforeLen)
|
||||
markdown := maxContent(sqlBlock.Markdown, 5120)
|
||||
content = maxContent(content, 5120)
|
||||
markdown := maxContent(sqlBlock.Markdown, 5120)
|
||||
|
||||
block = &Block{
|
||||
Box: sqlBlock.Box,
|
||||
Path: p,
|
||||
ID: id,
|
||||
RootID: sqlBlock.RootID,
|
||||
ParentID: sqlBlock.ParentID,
|
||||
Alias: sqlBlock.Alias,
|
||||
Name: sqlBlock.Name,
|
||||
Memo: sqlBlock.Memo,
|
||||
Tag: sqlBlock.Tag,
|
||||
Content: content,
|
||||
FContent: sqlBlock.FContent,
|
||||
Markdown: markdown,
|
||||
Type: treenode.FromAbbrType(sqlBlock.Type),
|
||||
SubType: sqlBlock.SubType,
|
||||
Box: sqlBlock.Box,
|
||||
Path: p,
|
||||
ID: id,
|
||||
RootID: sqlBlock.RootID,
|
||||
ParentID: sqlBlock.ParentID,
|
||||
Alias: sqlBlock.Alias,
|
||||
Name: sqlBlock.Name,
|
||||
Memo: sqlBlock.Memo,
|
||||
Tag: sqlBlock.Tag,
|
||||
Content: content,
|
||||
FContent: sqlBlock.FContent,
|
||||
Markdown: markdown,
|
||||
FMarkdown: sqlBlock.FMarkdown,
|
||||
Type: treenode.FromAbbrType(sqlBlock.Type),
|
||||
SubType: sqlBlock.SubType,
|
||||
}
|
||||
if "" != sqlBlock.IAL {
|
||||
block.IAL = map[string]string{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue