mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-14 19:18:06 +01:00
🎨 Supports multiple views for the database https://github.com/siyuan-note/siyuan/issues/9751
This commit is contained in:
parent
0cf13cca8f
commit
1f130d4b1c
2 changed files with 24 additions and 3 deletions
|
|
@ -747,6 +747,29 @@ func (av *AttributeView) GetBlockKey() (ret *Key) {
|
|||
return
|
||||
}
|
||||
|
||||
func (av *AttributeView) GetDuplicateViewName(masterViewName string) string {
|
||||
count := 1
|
||||
ret := masterViewName + " (" + strconv.Itoa(count) + ")"
|
||||
|
||||
existViewByName := func(name string) bool {
|
||||
for _, v := range av.Views {
|
||||
if v.Name == name {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
for i := 0; i < 32; i++ {
|
||||
if !existViewByName(ret) {
|
||||
return ret
|
||||
}
|
||||
count++
|
||||
ret = masterViewName + " (" + strconv.Itoa(count) + ")"
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func GetAttributeViewDataPath(avID string) (ret string) {
|
||||
av := filepath.Join(util.DataDir, "storage", "av")
|
||||
ret = filepath.Join(av, avID+".json")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue