Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
e62ccfc239
3 changed files with 40 additions and 11 deletions
|
@ -2339,9 +2339,23 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
|||
if nil != cell.Value.Updated {
|
||||
cell.Value.Updated = av.NewFormattedValueUpdated(cell.Value.Updated.Content, 0, av.UpdatedFormatNone)
|
||||
}
|
||||
} else if av.KeyTypeURL == cell.Value.Type {
|
||||
if nil != cell.Value.URL {
|
||||
if "" != strings.TrimSpace(cell.Value.URL.Content) {
|
||||
link := &ast.Node{Type: ast.NodeLink}
|
||||
link.AppendChild(&ast.Node{Type: ast.NodeOpenBracket})
|
||||
link.AppendChild(&ast.Node{Type: ast.NodeLinkText, Tokens: []byte(cell.Value.URL.Content)})
|
||||
link.AppendChild(&ast.Node{Type: ast.NodeCloseBracket})
|
||||
link.AppendChild(&ast.Node{Type: ast.NodeOpenParen})
|
||||
link.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: []byte(cell.Value.URL.Content)})
|
||||
link.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
|
||||
mdTableCell.AppendChild(link)
|
||||
}
|
||||
continue
|
||||
}
|
||||
} else if av.KeyTypeMAsset == cell.Value.Type {
|
||||
if nil != cell.Value.MAsset {
|
||||
for _, a := range cell.Value.MAsset {
|
||||
for i, a := range cell.Value.MAsset {
|
||||
if av.AssetTypeImage == a.Type {
|
||||
img := &ast.Node{Type: ast.NodeImage}
|
||||
img.AppendChild(&ast.Node{Type: ast.NodeBang})
|
||||
|
@ -2353,14 +2367,26 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
|||
img.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
|
||||
mdTableCell.AppendChild(img)
|
||||
} else if av.AssetTypeFile == a.Type {
|
||||
file := &ast.Node{Type: ast.NodeLink}
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeOpenBracket})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeLinkText, Tokens: []byte(a.Name)})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeCloseBracket})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeOpenParen})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: []byte(a.Content)})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
|
||||
mdTableCell.AppendChild(file)
|
||||
linkText := strings.TrimSpace(a.Name)
|
||||
if "" == linkText {
|
||||
linkText = a.Content
|
||||
}
|
||||
|
||||
if "" != strings.TrimSpace(a.Content) {
|
||||
file := &ast.Node{Type: ast.NodeLink}
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeOpenBracket})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeLinkText, Tokens: []byte(linkText)})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeCloseBracket})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeOpenParen})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: []byte(a.Content)})
|
||||
file.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
|
||||
mdTableCell.AppendChild(file)
|
||||
} else {
|
||||
mdTableCell.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)})
|
||||
}
|
||||
}
|
||||
if i < len(cell.Value.MAsset)-1 {
|
||||
mdTableCell.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(" ")})
|
||||
}
|
||||
}
|
||||
continue
|
||||
|
|
|
@ -798,6 +798,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
|
|||
refreshProtyle(id)
|
||||
}
|
||||
|
||||
sql.WaitForWritingDatabase()
|
||||
util.PushClearProgress()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -763,7 +763,6 @@ func (tx *Transaction) doDelete(operation *Operation) (ret *TxErr) {
|
|||
// 收集引用的定义块 ID
|
||||
refDefIDs := getRefDefIDs(node)
|
||||
// 推送定义节点引用计数
|
||||
refDefIDs = gulu.Str.RemoveDuplicatedElem(refDefIDs)
|
||||
for _, defID := range refDefIDs {
|
||||
defTree, _ := LoadTreeByBlockID(defID)
|
||||
if nil != defTree {
|
||||
|
@ -1082,7 +1081,6 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
|
|||
// 收集引用的定义块 ID
|
||||
refDefIDs := getRefDefIDs(insertedNode)
|
||||
// 推送定义节点引用计数
|
||||
refDefIDs = gulu.Str.RemoveDuplicatedElem(refDefIDs)
|
||||
for _, defID := range refDefIDs {
|
||||
defTree, _ := LoadTreeByBlockID(defID)
|
||||
if nil != defTree {
|
||||
|
@ -1233,9 +1231,13 @@ func getRefDefIDs(node *ast.Node) (refDefIDs []string) {
|
|||
|
||||
if treenode.IsBlockRef(n) {
|
||||
refDefIDs = append(refDefIDs, n.TextMarkBlockRefID)
|
||||
} else if treenode.IsEmbedBlockRef(n) {
|
||||
defID := treenode.GetEmbedBlockRef(n)
|
||||
refDefIDs = append(refDefIDs, defID)
|
||||
}
|
||||
return ast.WalkContinue
|
||||
})
|
||||
refDefIDs = gulu.Str.RemoveDuplicatedElem(refDefIDs)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue