Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-09 18:22:08 +08:00
parent ff72ff1f27
commit ca179523c3
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 15 additions and 7 deletions

View file

@ -2583,7 +2583,7 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
// 导出时去掉内容块闪卡样式 https://github.com/siyuan-note/siyuan/issues/7374
if n.IsBlock() {
n.RemoveIALAttr("custom-riff-decks")
n.RemoveIALAttr(NodeAttrRiffDecks)
}
switch n.Type {

View file

@ -985,15 +985,19 @@ func DuplicateDoc(tree *parse.Tree) {
previousPath := tree.Path
resetTree(tree, "Duplicated", false)
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering || !n.IsBlock() {
return ast.WalkContinue
}
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
n.RemoveIALAttr(av.NodeAttrNameAvs)
n.RemoveIALAttr(av.NodeAttrViewNames)
n.RemoveIALAttrsByPrefix(av.NodeAttrViewStaticText)
// 复制为副本时移除闪卡相关属性 https://github.com/siyuan-note/siyuan/issues/13987
n.RemoveIALAttr(NodeAttrRiffDecks)
return ast.WalkContinue
})

View file

@ -804,7 +804,7 @@ func (tx *Transaction) removeBlocksDeckAttr(blockIDs []string, deckID string) (e
oldAttrs := parse.IAL2Map(node.KramdownIAL)
deckAttrs := node.IALAttr("custom-riff-decks")
deckAttrs := node.IALAttr(NodeAttrRiffDecks)
var deckIDs []string
if "" != deckID {
availableDeckIDs := getDeckIDs()
@ -820,9 +820,9 @@ func (tx *Transaction) removeBlocksDeckAttr(blockIDs []string, deckID string) (e
val = strings.TrimPrefix(val, ",")
val = strings.TrimSuffix(val, ",")
if "" == val {
node.RemoveIALAttr("custom-riff-decks")
node.RemoveIALAttr(NodeAttrRiffDecks)
} else {
node.SetIALAttr("custom-riff-decks", val)
node.SetIALAttr(NodeAttrRiffDecks, val)
}
tx.writeTree(tree)
@ -910,14 +910,14 @@ func (tx *Transaction) doAddFlashcards(operation *Operation) (ret *TxErr) {
oldAttrs := parse.IAL2Map(node.KramdownIAL)
deckAttrs := node.IALAttr("custom-riff-decks")
deckAttrs := node.IALAttr(NodeAttrRiffDecks)
deckIDs := strings.Split(deckAttrs, ",")
deckIDs = append(deckIDs, deckID)
deckIDs = gulu.Str.RemoveDuplicatedElem(deckIDs)
val := strings.Join(deckIDs, ",")
val = strings.TrimPrefix(val, ",")
val = strings.TrimSuffix(val, ",")
node.SetIALAttr("custom-riff-decks", val)
node.SetIALAttr(NodeAttrRiffDecks, val)
tx.writeTree(tree)
@ -1195,3 +1195,7 @@ func getDeckDueCards(deck *riff.Deck, reviewedCardIDs, blockIDs []string, newCar
}
return
}
const (
NodeAttrRiffDecks = "custom-riff-decks"
)