mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-28 12:28:48 +01:00
🎨 Parse <img> tags when pasting https://github.com/siyuan-note/siyuan/issues/15464
This commit is contained in:
parent
6e6522d56a
commit
aabb85d895
1 changed files with 9 additions and 0 deletions
|
|
@ -1374,6 +1374,15 @@ func htmlBlock2Inline(tree *parse.Tree) {
|
|||
img.AppendChild(&ast.Node{Type: ast.NodeLinkTitle})
|
||||
}
|
||||
img.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
|
||||
if width := domAttrValue(htmlImg, "width"); "" != width {
|
||||
if util2.IsDigit(width) {
|
||||
width += "px"
|
||||
}
|
||||
style := "width: " + width + ";"
|
||||
ial := &ast.Node{Type: ast.NodeKramdownSpanIAL, Tokens: parse.IAL2Tokens([][]string{{"style", style}})}
|
||||
img.SetIALAttr("style", style)
|
||||
img.InsertAfter(ial)
|
||||
}
|
||||
|
||||
if nil != n.Parent && ast.NodeText == n.Type {
|
||||
// 行级 HTML 会被解析为文本,所以这里要在父级段落前面插入,避免形成段落嵌套 https://github.com/siyuan-note/siyuan/issues/13080
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue