mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 23:38:49 +01:00
🎨 闪卡界面大小调整及添加预览 https://github.com/siyuan-note/siyuan/issues/7368
This commit is contained in:
parent
5a27bc1960
commit
4782573544
1 changed files with 18 additions and 10 deletions
|
|
@ -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)
|
||||
}
|
||||
sort.Strings(allBlockIDs)
|
||||
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)
|
||||
start := (page - 1) * pageSize
|
||||
end := page * pageSize
|
||||
if start > len(allBlockIDs) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue