mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
370d549a48
commit
f5b17b2b22
8 changed files with 8 additions and 21 deletions
|
|
@ -762,7 +762,7 @@ export abstract class Constants {
|
||||||
</svg>`;
|
</svg>`;
|
||||||
|
|
||||||
// assets
|
// 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_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_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);
|
public static readonly SIYUAN_ASSETS_EXTS: string[] = [".pdf"].concat(Constants.SIYUAN_ASSETS_IMAGE).concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO);
|
||||||
|
|
|
||||||
|
|
@ -620,7 +620,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
|
||||||
}
|
}
|
||||||
|
|
||||||
item.setAttribute(key, data.new[key]);
|
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";
|
item.style.animation = "addCard 450ms linear";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (item.parentElement) {
|
if (item.parentElement) {
|
||||||
|
|
|
||||||
|
|
@ -2970,7 +2970,6 @@ func (tx *Transaction) setAttributeViewName(operation *Operation) (err error) {
|
||||||
oldAttrs := parse.IAL2Map(node.KramdownIAL)
|
oldAttrs := parse.IAL2Map(node.KramdownIAL)
|
||||||
node.SetIALAttr(av.NodeAttrViewNames, avNames)
|
node.SetIALAttr(av.NodeAttrViewNames, avNames)
|
||||||
pushBroadcastAttrTransactions(oldAttrs, node)
|
pushBroadcastAttrTransactions(oldAttrs, node)
|
||||||
node.RemoveIALAttr(av.NodeAttrViewNames)
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -3562,7 +3561,6 @@ func removeNodeAvID(node *ast.Node, avID string, tx *Transaction, tree *parse.Tr
|
||||||
node.RemoveIALAttr("custom-hidden")
|
node.RemoveIALAttr("custom-hidden")
|
||||||
}
|
}
|
||||||
|
|
||||||
var avNames string
|
|
||||||
if avs := attrs[av.NodeAttrNameAvs]; "" != avs {
|
if avs := attrs[av.NodeAttrNameAvs]; "" != avs {
|
||||||
avIDs := strings.Split(avs, ",")
|
avIDs := strings.Split(avs, ",")
|
||||||
avIDs = gulu.Str.RemoveElem(avIDs, avID)
|
avIDs = gulu.Str.RemoveElem(avIDs, avID)
|
||||||
|
|
@ -3579,7 +3577,7 @@ func removeNodeAvID(node *ast.Node, avID string, tx *Transaction, tree *parse.Tr
|
||||||
} else {
|
} else {
|
||||||
attrs[av.NodeAttrNameAvs] = strings.Join(avIDs, ",")
|
attrs[av.NodeAttrNameAvs] = strings.Join(avIDs, ",")
|
||||||
node.SetIALAttr(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
|
attrs[av.NodeAttrViewNames] = avNames
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3593,9 +3591,6 @@ func removeNodeAvID(node *ast.Node, avID string, tx *Transaction, tree *parse.Tr
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if "" != avNames {
|
|
||||||
node.RemoveIALAttr(av.NodeAttrViewNames)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5051,9 +5046,6 @@ func unbindBlockAv(tx *Transaction, avID, nodeID string) {
|
||||||
logging.LogWarnf("set node [%s] attrs failed: %s", nodeID, err)
|
logging.LogWarnf("set node [%s] attrs failed: %s", nodeID, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if "" != avNames {
|
|
||||||
node.RemoveIALAttr(av.NodeAttrViewNames)
|
|
||||||
}
|
|
||||||
return
|
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)
|
logging.LogWarnf("set node [%s] attrs failed: %s", node.ID, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if "" != avNames {
|
|
||||||
node.RemoveIALAttr(av.NodeAttrViewNames)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -988,6 +988,7 @@ func DuplicateDoc(tree *parse.Tree) {
|
||||||
}
|
}
|
||||||
|
|
||||||
n.RemoveIALAttr(av.NodeAttrNameAvs)
|
n.RemoveIALAttr(av.NodeAttrNameAvs)
|
||||||
|
n.RemoveIALAttr(av.NodeAttrViewNames)
|
||||||
n.RemoveIALAttrsByPrefix(av.NodeAttrViewStaticText)
|
n.RemoveIALAttrsByPrefix(av.NodeAttrViewStaticText)
|
||||||
return ast.WalkContinue
|
return ast.WalkContinue
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -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]
|
rendererFunc := blockRenderer.RendererFuncs[n.Type]
|
||||||
|
|
|
||||||
|
|
@ -1073,7 +1073,6 @@ func (tx *Transaction) syncDelete2Block(node *ast.Node, nodeTree *parse.Tree) (c
|
||||||
oldAttrs := parse.IAL2Map(toChangNode.KramdownIAL)
|
oldAttrs := parse.IAL2Map(toChangNode.KramdownIAL)
|
||||||
toChangNode.SetIALAttr(av.NodeAttrViewNames, avNames)
|
toChangNode.SetIALAttr(av.NodeAttrViewNames, avNames)
|
||||||
pushBroadcastAttrTransactions(oldAttrs, toChangNode)
|
pushBroadcastAttrTransactions(oldAttrs, toChangNode)
|
||||||
toChangNode.RemoveIALAttr(av.NodeAttrViewNames)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tree := range trees {
|
for _, tree := range trees {
|
||||||
|
|
@ -1209,6 +1208,7 @@ func (tx *Transaction) doLargeInsert(previousID string) (ret *TxErr) {
|
||||||
|
|
||||||
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
|
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
|
||||||
insertedNode.RemoveIALAttr(av.NodeAttrNameAvs)
|
insertedNode.RemoveIALAttr(av.NodeAttrNameAvs)
|
||||||
|
insertedNode.RemoveIALAttr(av.NodeAttrViewNames)
|
||||||
insertedNode.RemoveIALAttrsByPrefix(av.NodeAttrViewStaticText)
|
insertedNode.RemoveIALAttrsByPrefix(av.NodeAttrViewStaticText)
|
||||||
|
|
||||||
if ast.NodeAttributeView == insertedNode.Type {
|
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
|
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
|
||||||
insertedNode.RemoveIALAttr(av.NodeAttrNameAvs)
|
insertedNode.RemoveIALAttr(av.NodeAttrNameAvs)
|
||||||
|
insertedNode.RemoveIALAttr(av.NodeAttrViewNames)
|
||||||
insertedNode.RemoveIALAttrsByPrefix(av.NodeAttrViewStaticText)
|
insertedNode.RemoveIALAttrsByPrefix(av.NodeAttrViewStaticText)
|
||||||
|
|
||||||
if ast.NodeAttributeView == insertedNode.Type {
|
if ast.NodeAttributeView == insertedNode.Type {
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ func RemoveID(name string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
var commonSuffixes = []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",
|
".txt", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".md", ".rtf",
|
||||||
".zip", ".rar", ".7z", ".tar", ".gz", ".bz2",
|
".zip", ".rar", ".7z", ".tar", ".gz", ".bz2",
|
||||||
".mp3", ".wav", ".aac", ".flac", ".ogg", ".m4a",
|
".mp3", ".wav", ".aac", ".flac", ".ogg", ".m4a",
|
||||||
|
|
|
||||||
|
|
@ -479,6 +479,7 @@ func initMime() {
|
||||||
mime.AddExtensionType(".gif", "image/gif")
|
mime.AddExtensionType(".gif", "image/gif")
|
||||||
mime.AddExtensionType(".bmp", "image/bmp")
|
mime.AddExtensionType(".bmp", "image/bmp")
|
||||||
mime.AddExtensionType(".tiff", "image/tiff")
|
mime.AddExtensionType(".tiff", "image/tiff")
|
||||||
|
mime.AddExtensionType(".tif", "image/tiff")
|
||||||
mime.AddExtensionType(".webp", "image/webp")
|
mime.AddExtensionType(".webp", "image/webp")
|
||||||
mime.AddExtensionType(".ico", "image/x-icon")
|
mime.AddExtensionType(".ico", "image/x-icon")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue