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/pull/16449#issuecomment-3581097735

Danielf5b17b2b2210
diff --git a/app/src/constants.ts b/app/src/constants.ts
index 3e4e13c008..de1c852c8f 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -762,7 +762,7 @@ export abstract class Constants {
</svg>`;
// assets
- public static readonly SIYUAN_ASSETS_IMAGE: string[] = [".apng", ".ico", ".cur", ".jpg", ".jpe", ".jpeg", ".jfif", ".pjp", ".pjpeg", ".png", ".gif", ".webp", ".bmp", ".svg", ".avif"];
+ public static readonly SIYUAN_ASSETS_IMAGE: string[] = [".apng", ".ico", ".cur", ".jpg", ".jpe", ".jpeg", ".jfif", ".pjp", ".pjpeg", ".png", ".gif", ".webp", ".bmp", ".svg", ".avif", ".tiff", ".tif"];
public static readonly SIYUAN_ASSETS_AUDIO: string[] = [".mp3", ".wav", ".ogg", ".m4a", ".aac", ".flac"];
public static readonly SIYUAN_ASSETS_VIDEO: string[] = [".mov", ".weba", ".mkv", ".mp4", ".webm"];
public static readonly SIYUAN_ASSETS_EXTS: string[] = [".pdf"].concat(Constants.SIYUAN_ASSETS_IMAGE).concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO);
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index d8d2c541f2..69e54be0bc 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -620,7 +620,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
}
item.setAttribute(key, data.new[key]);
- if (key === Constants.CUSTOM_RIFF_DECKS && key !== data.old[Constants.CUSTOM_RIFF_DECKS]) {
+ if (key === Constants.CUSTOM_RIFF_DECKS && key !== data.new[Constants.CUSTOM_RIFF_DECKS]) {
item.style.animation = "addCard 450ms linear";
setTimeout(() => {
if (item.parentElement) {
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index dc590b8364..fd7b79ff29 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -2970,7 +2970,6 @@ func (tx *Transaction) setAttributeViewName(operation *Operation) (err error) {
oldAttrs := parse.IAL2Map(node.KramdownIAL)
node.SetIALAttr(av.NodeAttrViewNames, avNames)
pushBroadcastAttrTransactions(oldAttrs, node)
- node.RemoveIALAttr(av.NodeAttrViewNames)
}
return
}
@@ -3562,7 +3561,6 @@ func removeNodeAvID(node *ast.Node, avID string, tx *Transaction, tree *parse.Tr
node.RemoveIALAttr("custom-hidden")
}
- var avNames string
if avs := attrs[av.NodeAttrNameAvs]; "" != avs {
avIDs := strings.Split(avs, ",")
avIDs = gulu.Str.RemoveElem(avIDs, avID)
@@ -3579,7 +3577,7 @@ func removeNodeAvID(node *ast.Node, avID string, tx *Transaction, tree *parse.Tr
} else {
attrs[av.NodeAttrNameAvs] = strings.Join(avIDs, ",")
node.SetIALAttr(av.NodeAttrNameAvs, strings.Join(avIDs, ","))
- avNames = getAvNames(node.IALAttr(av.NodeAttrNameAvs))
+ avNames := getAvNames(node.IALAttr(av.NodeAttrNameAvs))
attrs[av.NodeAttrViewNames] = avNames
}
}
@@ -3593,9 +3591,6 @@ func removeNodeAvID(node *ast.Node, avID string, tx *Transaction, tree *parse.Tr
return
}
}
- if "" != avNames {
- node.RemoveIALAttr(av.NodeAttrViewNames)
- }
return
}
@@ -5051,9 +5046,6 @@ func unbindBlockAv(tx *Transaction, avID, nodeID string) {
logging.LogWarnf("set node [%s] attrs failed: %s", nodeID, err)
return
}
- if "" != avNames {
- node.RemoveIALAttr(av.NodeAttrViewNames)
- }
return
}
@@ -5093,9 +5085,6 @@ func bindBlockAv0(tx *Transaction, avID string, node *ast.Node, tree *parse.Tree
logging.LogWarnf("set node [%s] attrs failed: %s", node.ID, err)
return
}
- if "" != avNames {
- node.RemoveIALAttr(av.NodeAttrViewNames)
- }
return
}
diff --git a/kernel/model/file.go b/kernel/model/file.go
index dd7d7b7e9f..de0bf09f78 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -988,6 +988,7 @@ func DuplicateDoc(tree *parse.Tree) {
}
n.RemoveIALAttr(av.NodeAttrNameAvs)
+ n.RemoveIALAttr(av.NodeAttrViewNames)
n.RemoveIALAttrsByPrefix(av.NodeAttrViewStaticText)
return ast.WalkContinue
})
diff --git a/kernel/model/render.go b/kernel/model/render.go
index c6e9bbfe0a..26a4abdbcc 100644
--- a/kernel/model/render.go
+++ b/kernel/model/render.go
@@ -190,11 +190,6 @@ func renderBlockDOMByNodes(nodes []*ast.Node, luteEngine *lute.Lute) string {
}
}
}
- } else {
- // 填充属性视图角标之后即可移除 av-names 属性
- if n.IsBlock() && "" != n.IALAttr(av.NodeAttrViewNames) {
- n.RemoveIALAttr(av.NodeAttrViewNames)
- }
}
rendererFunc := blockRenderer.RendererFuncs[n.Type]
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index a0277cb697..ba8d44f836 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -1073,7 +1073,6 @@ func (tx *Transaction) syncDelete2Block(node *ast.Node, nodeTree *parse.Tree) (c
oldAttrs := parse.IAL2Map(toChangNode.KramdownIAL)
toChangNode.SetIALAttr(av.NodeAttrViewNames, avNames)
pushBroadcastAttrTransactions(oldAttrs, toChangNode)
- toChangNode.RemoveIALAttr(av.NodeAttrViewNames)
}
for _, tree := range trees {
@@ -1209,6 +1208,7 @@ func (tx *Transaction) doLargeInsert(previousID string) (ret *TxErr) {
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
insertedNode.RemoveIALAttr(av.NodeAttrNameAvs)
+ insertedNode.RemoveIALAttr(av.NodeAttrViewNames)
insertedNode.RemoveIALAttrsByPrefix(av.NodeAttrViewStaticText)
if ast.NodeAttributeView == insertedNode.Type {
@@ -1387,6 +1387,7 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
insertedNode.RemoveIALAttr(av.NodeAttrNameAvs)
+ insertedNode.RemoveIALAttr(av.NodeAttrViewNames)
insertedNode.RemoveIALAttrsByPrefix(av.NodeAttrViewStaticText)
if ast.NodeAttributeView == insertedNode.Type {
diff --git a/kernel/util/file.go b/kernel/util/file.go
index afe035dc7d..aebeab4f94 100644
--- a/kernel/util/file.go
+++ b/kernel/util/file.go
@@ -149,7 +149,7 @@ func RemoveID(name string) string {
}
var commonSuffixes = []string{
- ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".svg", ".webp", ".tiff",
+ ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".svg", ".webp", ".tif", ".tiff",
".txt", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".md", ".rtf",
".zip", ".rar", ".7z", ".tar", ".gz", ".bz2",
".mp3", ".wav", ".aac", ".flac", ".ogg", ".m4a",
diff --git a/kernel/util/working.go b/kernel/util/working.go
index edd28cbabd..4a64f95f21 100644
--- a/kernel/util/working.go
+++ b/kernel/util/working.go
@@ -479,6 +479,7 @@ func initMime() {
mime.AddExtensionType(".gif", "image/gif")
mime.AddExtensionType(".bmp", "image/bmp")
mime.AddExtensionType(".tiff", "image/tiff")
+ mime.AddExtensionType(".tif", "image/tiff")
mime.AddExtensionType(".webp", "image/webp")
mime.AddExtensionType(".ico", "image/x-icon")
}