Daniel 2024-11-10 12:04:56 +08:00
parent 14f5570558
commit a0491cd4ff
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
13 changed files with 21 additions and 18 deletions

View file

@ -395,7 +395,7 @@ func SwapBlockRef(refID, defID string, includeChildren bool) (err error) {
refreshUpdated(defNode)
refreshUpdated(refNode)
refPivot := treenode.NewParagraph()
refPivot := treenode.NewParagraph("")
refNode.InsertBefore(refPivot)
if ast.NodeListItem == defNode.Type {

View file

@ -496,7 +496,7 @@ func parseKTree(kramdown []byte) (ret *parse.Tree) {
func normalizeTree(tree *parse.Tree) (yfmRootID, yfmTitle, yfmUpdated string) {
if nil == tree.Root.FirstChild {
tree.Root.AppendChild(treenode.NewParagraph())
tree.Root.AppendChild(treenode.NewParagraph(""))
}
var unlinks []*ast.Node

View file

@ -46,7 +46,7 @@ func mergeSubDocs(rootTree *parse.Tree) (ret *parse.Tree, err error) {
insertPoint = rootTree.Root.FirstChild
if nil == insertPoint {
// 如果文档为空,则创建一个空段落作为插入点
insertPoint = treenode.NewParagraph()
insertPoint = treenode.NewParagraph("")
rootTree.Root.AppendChild(insertPoint)
}
}

View file

@ -1870,7 +1870,7 @@ func createDoc(boxID, p, title, dom string) (tree *parse.Tree, err error) {
updated := util.TimeFromID(id)
tree.Root.KramdownIAL = [][]string{{"id", id}, {"title", html.EscapeAttrVal(title)}, {"updated", updated}}
if nil == tree.Root.FirstChild {
tree.Root.AppendChild(treenode.NewParagraph())
tree.Root.AppendChild(treenode.NewParagraph(""))
}
// 如果段落块中仅包含一个 mp3/mp4 超链接,则将其转换为音视频块

View file

@ -195,7 +195,7 @@ func Doc2Heading(srcID, targetID string, after bool) (srcTreeBox, srcTreePath st
if "" != tagIAL && 0 < len(tags) {
// 带标签的文档块转换为标题块时将标签移动到标题块下方 https://github.com/siyuan-note/siyuan/issues/6550
tagPara := treenode.NewParagraph()
tagPara := treenode.NewParagraph("")
for i, tag := range tags {
if "" == tag {
continue
@ -365,7 +365,7 @@ func Heading2Doc(srcHeadingID, targetBoxID, targetPath string) (srcRootBlockID,
headingNode.Unlink()
srcTree.Root.SetIALAttr("updated", util.CurrentTimeSecondsStr())
if nil == srcTree.Root.FirstChild {
srcTree.Root.AppendChild(treenode.NewParagraph())
srcTree.Root.AppendChild(treenode.NewParagraph(""))
}
treenode.RemoveBlockTreesByRootID(srcTree.ID)
if err = indexWriteTreeUpsertQueue(srcTree); err != nil {

View file

@ -1137,7 +1137,7 @@ func imgHtmlBlock2InlineImg(tree *parse.Tree) {
alt := domAttrValue(htmlImg, "alt")
title := domAttrValue(htmlImg, "title")
p := &ast.Node{Type: ast.NodeParagraph, ID: n.ID}
p := treenode.NewParagraph(n.ID)
img := &ast.Node{Type: ast.NodeImage}
p.AppendChild(img)
img.AppendChild(&ast.Node{Type: ast.NodeBang})

View file

@ -73,7 +73,7 @@ func ListItem2Doc(srcListItemID, targetBoxID, targetPath string) (srcRootBlockID
children = append(children, c)
}
if 1 > len(children) {
newNode := treenode.NewParagraph()
newNode := treenode.NewParagraph("")
children = append(children, newNode)
}
@ -97,7 +97,7 @@ func ListItem2Doc(srcListItemID, targetBoxID, targetPath string) (srcRootBlockID
}
srcTree.Root.SetIALAttr("updated", util.CurrentTimeSecondsStr())
if nil == srcTree.Root.FirstChild {
srcTree.Root.AppendChild(treenode.NewParagraph())
srcTree.Root.AppendChild(treenode.NewParagraph(""))
}
treenode.RemoveBlockTreesByRootID(srcTree.ID)
if err = indexWriteTreeUpsertQueue(srcTree); err != nil {

View file

@ -341,9 +341,9 @@ func RenderTemplate(p, id string, preview bool) (tree *parse.Tree, dom string, e
})
for _, n := range nodesNeedAppendChild {
if ast.NodeBlockquote == n.Type {
n.FirstChild.InsertAfter(treenode.NewParagraph())
n.FirstChild.InsertAfter(treenode.NewParagraph(""))
} else {
n.AppendChild(treenode.NewParagraph())
n.AppendChild(treenode.NewParagraph(""))
}
}
for _, n := range unlinks {