mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
♻️ 移除旧版中的行级元素实现代码 https://github.com/siyuan-note/siyuan/issues/6819
This commit is contained in:
parent
c69983c56c
commit
637f1427e4
11 changed files with 24 additions and 322 deletions
|
|
@ -27,7 +27,6 @@ import (
|
|||
"github.com/emirpasic/gods/sets/hashset"
|
||||
"github.com/siyuan-note/eventbus"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/treenode"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
|
|
@ -473,30 +472,6 @@ func upsertTree(tx *sql.Tx, tree *parse.Tree, context map[string]interface{}) (e
|
|||
if err = insertBlocks(tx, blocks, context); nil != err {
|
||||
return
|
||||
}
|
||||
anchors := map[string]string{}
|
||||
var refIDs []string
|
||||
for _, block := range blocks {
|
||||
if "" != block.Content {
|
||||
// content 不为空的话说明是定值,不需要解析引用内容
|
||||
continue
|
||||
}
|
||||
subTree := parse.Parse("", []byte(block.Markdown), luteEngine.ParseOptions)
|
||||
if nil == subTree {
|
||||
logging.LogErrorf("parse temp block [%s] failed: %s", block.ID, err)
|
||||
continue
|
||||
}
|
||||
if 0 < len(treenode.GetLegacyDynamicBlockRefDefIDs(subTree.Root)) {
|
||||
refIDs = append(refIDs, block.ID)
|
||||
}
|
||||
}
|
||||
// 先删除再插入会快很多
|
||||
refBlocks := GetBlocks(refIDs)
|
||||
for _, refBlock := range refBlocks {
|
||||
blockContent := ResolveRefContent(refBlock, &anchors)
|
||||
refBlock.Content = blockContent
|
||||
}
|
||||
deleteBlocksByIDs(tx, refIDs)
|
||||
insertBlocks(tx, refBlocks, context)
|
||||
|
||||
refs, fileAnnotationRefs := refsFromTree(tree)
|
||||
if err = insertRefs(tx, refs); nil != err {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue