Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 闪卡界面大小调整及添加预览 https://github.com/siyuan-note/siyuan/issues/7368

Liang Ding478257354445
diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.go
index a2cbc74975..72692c3a99 100644
--- a/kernel/model/flashcard.go
+++ b/kernel/model/flashcard.go
@@ -43,18 +43,26 @@ var deckLock = sync.Mutex{}
func GetFlashcards(deckID string, page int) (blocks []*Block, total, pageCount int) {
blocks = []*Block{}
- deck := Decks[deckID]
- if nil == deck {
- return
- }
-
- const pageSize = 20
var allBlockIDs []string
- for bID, _ := range deck.BlockCard {
- allBlockIDs = append(allBlockIDs, bID)
+ const pageSize = 20
+ if "" == deckID {
+ for _, deck := range Decks {
+ for bID, _ := range deck.BlockCard {
+ allBlockIDs = append(allBlockIDs, bID)
+ }
+ }
+ } else {
+ deck := Decks[deckID]
+ if nil == deck {
+ return
+ }
+
+ for bID, _ := range deck.BlockCard {
+ allBlockIDs = append(allBlockIDs, bID)
+ }
}
- sort.Strings(allBlockIDs)
+ sort.Strings(allBlockIDs)
start := (page - 1) * pageSize
end := page * pageSize
if start > len(allBlockIDs) {