mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-15 11:38:06 +01:00
Revert "🧑💻 Improve kernel API /api/block/updateBlock and /api/block/batchUpdateBlock https://github.com/siyuan-note/siyuan/issues/15301"
This reverts commit d7c95e1b49f753ab5231d4ba98c2dcf3578067da.
This commit is contained in:
parent
858c7e7618
commit
0d3df5d449
12 changed files with 149 additions and 94 deletions
|
|
@ -310,7 +310,7 @@ func Export2Liandi(id string) (err error) {
|
|||
articleId = result.Data.(string)
|
||||
tree, _ = LoadTreeByBlockID(id) // 这里必须重新加载,因为前面导出时已经修改了树结构
|
||||
tree.Root.SetIALAttr(liandiArticleIdAttrName, articleId)
|
||||
if err = WriteTreeUpsertQueue(tree); err != nil {
|
||||
if err = writeTreeUpsertQueue(tree); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -1994,7 +1994,7 @@ func ExportMarkdownContent(id string, refMode, embedMode int, addYfm, fillCSSVar
|
|||
}
|
||||
|
||||
func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []string, singleFile bool, treeCache *map[string]*parse.Tree) (tree *parse.Tree, exportedMd string, isEmpty bool) {
|
||||
tree, err := LoadTreeWithCache(id, treeCache)
|
||||
tree, err := loadTreeWithCache(id, treeCache)
|
||||
if err != nil {
|
||||
logging.LogErrorf("load tree by block id [%s] failed: %s", id, err)
|
||||
return
|
||||
|
|
@ -2788,7 +2788,7 @@ func resolveFootnotesDefs(refFootnotes *[]*refAsFootnotes, currentTree *parse.Tr
|
|||
footnotesDefBlock = &ast.Node{Type: ast.NodeFootnotesDefBlock}
|
||||
var rendered []string
|
||||
for _, foot := range *refFootnotes {
|
||||
t, err := LoadTreeWithCache(foot.defID, treeCache)
|
||||
t, err := loadTreeWithCache(foot.defID, treeCache)
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
|
@ -2924,7 +2924,7 @@ func blockLink2Ref(currentTree *parse.Tree, id string, treeCache *map[string]*pa
|
|||
if nil == b {
|
||||
return
|
||||
}
|
||||
t, err := LoadTreeWithCache(b.RootID, treeCache)
|
||||
t, err := loadTreeWithCache(b.RootID, treeCache)
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
|
@ -2974,7 +2974,7 @@ func collectFootnotesDefs(currentTree *parse.Tree, id string, refFootnotes *[]*r
|
|||
if nil == b {
|
||||
return
|
||||
}
|
||||
t, err := LoadTreeWithCache(b.RootID, treeCache)
|
||||
t, err := loadTreeWithCache(b.RootID, treeCache)
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
|
@ -3265,7 +3265,7 @@ func prepareExportTrees(docPaths []string) (defBlockIDs []string, trees *map[str
|
|||
continue
|
||||
}
|
||||
|
||||
tree, err := LoadTreeWithCache(rootID, treeCache)
|
||||
tree, err := loadTreeWithCache(rootID, treeCache)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
|
@ -3307,7 +3307,7 @@ func exportRefTrees(tree *parse.Tree, defBlockIDs *[]string, retTrees, treeCache
|
|||
if (*treeCache)[defBlock.RootID] != nil {
|
||||
defTree = (*treeCache)[defBlock.RootID]
|
||||
} else {
|
||||
defTree, err = LoadTreeWithCache(defBlock.RootID, treeCache)
|
||||
defTree, err = loadTreeWithCache(defBlock.RootID, treeCache)
|
||||
if err != nil {
|
||||
return ast.WalkSkipChildren
|
||||
}
|
||||
|
|
@ -3331,7 +3331,7 @@ func exportRefTrees(tree *parse.Tree, defBlockIDs *[]string, retTrees, treeCache
|
|||
if (*treeCache)[defBlock.RootID] != nil {
|
||||
defTree = (*treeCache)[defBlock.RootID]
|
||||
} else {
|
||||
defTree, err = LoadTreeWithCache(defBlock.RootID, treeCache)
|
||||
defTree, err = loadTreeWithCache(defBlock.RootID, treeCache)
|
||||
if err != nil {
|
||||
return ast.WalkSkipChildren
|
||||
}
|
||||
|
|
@ -3370,7 +3370,7 @@ func exportRefTrees(tree *parse.Tree, defBlockIDs *[]string, retTrees, treeCache
|
|||
if (*treeCache)[defBlock.RootID] != nil {
|
||||
defTree = (*treeCache)[defBlock.RootID]
|
||||
} else {
|
||||
defTree, err = LoadTreeWithCache(defBlock.RootID, treeCache)
|
||||
defTree, err = loadTreeWithCache(defBlock.RootID, treeCache)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
|
@ -3387,6 +3387,17 @@ func exportRefTrees(tree *parse.Tree, defBlockIDs *[]string, retTrees, treeCache
|
|||
*defBlockIDs = gulu.Str.RemoveDuplicatedElem(*defBlockIDs)
|
||||
}
|
||||
|
||||
func loadTreeWithCache(id string, treeCache *map[string]*parse.Tree) (tree *parse.Tree, err error) {
|
||||
if tree = (*treeCache)[id]; nil != tree {
|
||||
return
|
||||
}
|
||||
tree, err = LoadTreeByBlockID(id)
|
||||
if nil == err && nil != tree {
|
||||
(*treeCache)[id] = tree
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func getAttrViewTable(attrView *av.AttributeView, view *av.View, query string) (ret *av.Table) {
|
||||
switch view.LayoutType {
|
||||
case av.LayoutTypeGallery:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue