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/13987

Danielca179523c30e
diff --git a/kernel/model/export.go b/kernel/model/export.go
index 60f93567e9..2d910e7fb3 100644
--- a/kernel/model/export.go
+++ b/kernel/model/export.go
@@ -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 {
diff --git a/kernel/model/file.go b/kernel/model/file.go
index 339bd4c4e9..b64ce57a8d 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -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
})
diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.go
index 59e6b42c36..229d1b185c 100644
--- a/kernel/model/flashcard.go
+++ b/kernel/model/flashcard.go
@@ -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"
+)