Sfoglia il codice sorgente

:art: Rows non-bound in the database support `Add to Database` https://github.com/siyuan-note/siyuan/issues/11093

Daniel 1 anno fa
parent
commit
e16c3cb0fe
2 ha cambiato i file con 10 aggiunte e 3 eliminazioni
  1. 7 1
      kernel/api/av.go
  2. 3 2
      kernel/model/attribute_view.go

+ 7 - 1
kernel/api/av.go

@@ -318,7 +318,13 @@ func searchAttributeView(c *gin.Context) {
 	}
 
 	keyword := arg["keyword"].(string)
-	results := model.SearchAttributeView(keyword)
+	var excludes []string
+	if nil != arg["excludes"] {
+		for _, e := range arg["excludes"].([]interface{}) {
+			excludes = append(excludes, e.(string))
+		}
+	}
+	results := model.SearchAttributeView(keyword, excludes)
 	ret.Data = map[string]interface{}{
 		"results": results,
 	}

+ 3 - 2
kernel/model/attribute_view.go

@@ -186,8 +186,9 @@ type SearchAttributeViewResult struct {
 	HPath   string `json:"hPath"`
 }
 
-func SearchAttributeView(keyword string) (ret []*SearchAttributeViewResult) {
+func SearchAttributeView(keyword string, excludes []string) (ret []*SearchAttributeViewResult) {
 	waitForSyncingStorages()
+
 	ret = []*SearchAttributeViewResult{}
 	keyword = strings.TrimSpace(keyword)
 
@@ -321,7 +322,7 @@ func SearchAttributeView(keyword string) (ret []*SearchAttributeViewResult) {
 			hPath = box.Name + hPath
 		}
 
-		if !exist {
+		if !exist && !gulu.Str.Contains(avID, excludes) {
 			ret = append(ret, &SearchAttributeViewResult{
 				AvID:    avID,
 				AvName:  existAv.AvName,