Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-11-26 20:45:37 +08:00
parent 370d549a48
commit f5b17b2b22
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
8 changed files with 8 additions and 21 deletions

View file

@ -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);

View file

@ -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) {

View file

@ -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
}

View file

@ -988,6 +988,7 @@ func DuplicateDoc(tree *parse.Tree) {
}
n.RemoveIALAttr(av.NodeAttrNameAvs)
n.RemoveIALAttr(av.NodeAttrViewNames)
n.RemoveIALAttrsByPrefix(av.NodeAttrViewStaticText)
return ast.WalkContinue
})

View file

@ -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]

View file

@ -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 {

View file

@ -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",

View file

@ -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")
}