|
@@ -311,7 +311,7 @@ func buildEmbedBlock(embedBlockID string, excludeIDs []string, headingMode int,
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets bool) (ret []*Block, newDoc bool) {
|
|
|
|
|
|
+func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets, isDatabase bool) (ret []*Block, newDoc bool) {
|
|
cachedTrees := map[string]*parse.Tree{}
|
|
cachedTrees := map[string]*parse.Tree{}
|
|
|
|
|
|
onlyDoc := false
|
|
onlyDoc := false
|
|
@@ -398,9 +398,13 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int, isSquareBrackets
|
|
}
|
|
}
|
|
ret = tmp
|
|
ret = tmp
|
|
|
|
|
|
- if block := treenode.GetBlockTree(id); nil != block {
|
|
|
|
- p := path.Join(block.HPath, keyword)
|
|
|
|
- newDoc = nil == treenode.GetBlockTreeRootByHPath(block.BoxID, p)
|
|
|
|
|
|
+ if !isDatabase {
|
|
|
|
+ // 如果非数据库中搜索块引,则不允许新建重名文档
|
|
|
|
+ // 如果是数据库中搜索绑定块,则允许新建重名文档 https://github.com/siyuan-note/siyuan/issues/11713
|
|
|
|
+ if block := treenode.GetBlockTree(id); nil != block {
|
|
|
|
+ p := path.Join(block.HPath, keyword)
|
|
|
|
+ newDoc = nil == treenode.GetBlockTreeRootByHPath(block.BoxID, p)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// 在 hPath 中加入笔记本名 Show notebooks in hpath of block ref search list results https://github.com/siyuan-note/siyuan/issues/9378
|
|
// 在 hPath 中加入笔记本名 Show notebooks in hpath of block ref search list results https://github.com/siyuan-note/siyuan/issues/9378
|