mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
🎨 Display document title in data history preview area https://github.com/siyuan-note/siyuan/issues/12948
This commit is contained in:
parent
face9918f1
commit
a15899d421
2 changed files with 5 additions and 2 deletions
|
|
@ -79,7 +79,7 @@ func GetRepoFile(fileID string) (ret []byte, p string, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func OpenRepoSnapshotDoc(fileID string) (content string, isProtyleDoc bool, updated int64, err error) {
|
||||
func OpenRepoSnapshotDoc(fileID string) (title, content string, isProtyleDoc bool, updated int64, err error) {
|
||||
if 1 > len(Conf.Repo.Key) {
|
||||
err = errors.New(Conf.Language(26))
|
||||
return
|
||||
|
|
@ -110,6 +110,7 @@ func OpenRepoSnapshotDoc(fileID string) (content string, isProtyleDoc bool, upda
|
|||
logging.LogErrorf("parse tree from snapshot file [%s] failed", fileID)
|
||||
return
|
||||
}
|
||||
title = snapshotTree.Root.IALAttr("title")
|
||||
|
||||
if !isProtyleDoc {
|
||||
renderTree := &parse.Tree{Root: &ast.Node{Type: ast.NodeDocument}}
|
||||
|
|
@ -150,6 +151,7 @@ func OpenRepoSnapshotDoc(fileID string) (content string, isProtyleDoc bool, upda
|
|||
}
|
||||
} else {
|
||||
isProtyleDoc = true
|
||||
title = path.Base(file.Path)
|
||||
if strings.HasSuffix(file.Path, ".json") {
|
||||
content = gulu.Str.FromBytes(data)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue