mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-17 01:21:14 +08:00
🎨 行级元素支持嵌套和交叉 https://github.com/siyuan-note/siyuan/issues/2911
This commit is contained in:
parent
b06f074f1b
commit
f7520a3f12
6
app/stage/protyle/js/lute/lute.min.js
vendored
6
app/stage/protyle/js/lute/lute.min.js
vendored
File diff suppressed because one or more lines are too long
@ -103,6 +103,10 @@ func WriteTree(tree *parse.Tree) (err error) {
|
|||||||
treenode.ReindexBlockTree(tree)
|
treenode.ReindexBlockTree(tree)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if "" == tree.Root.Spec {
|
||||||
|
treenode.NestedInlines2FlattedSpans(tree)
|
||||||
|
tree.Root.Spec = "1"
|
||||||
|
}
|
||||||
renderer := render.NewJSONRenderer(tree, luteEngine.RenderOptions)
|
renderer := render.NewJSONRenderer(tree, luteEngine.RenderOptions)
|
||||||
output := renderer.Render()
|
output := renderer.Render()
|
||||||
|
|
||||||
@ -181,6 +185,11 @@ func parseJSON2Tree(boxID, p string, jsonData []byte, luteEngine *lute.Lute) (re
|
|||||||
|
|
||||||
ret.Box = boxID
|
ret.Box = boxID
|
||||||
ret.Path = p
|
ret.Path = p
|
||||||
|
if "" == ret.Root.Spec {
|
||||||
|
treenode.NestedInlines2FlattedSpans(ret)
|
||||||
|
ret.Root.Spec = "1"
|
||||||
|
needFix = true
|
||||||
|
}
|
||||||
if needFix {
|
if needFix {
|
||||||
renderer := render.NewJSONRenderer(ret, luteEngine.RenderOptions)
|
renderer := render.NewJSONRenderer(ret, luteEngine.RenderOptions)
|
||||||
output := renderer.Render()
|
output := renderer.Render()
|
||||||
|
@ -7,7 +7,7 @@ require (
|
|||||||
github.com/88250/css v0.1.2
|
github.com/88250/css v0.1.2
|
||||||
github.com/88250/flock v0.8.2
|
github.com/88250/flock v0.8.2
|
||||||
github.com/88250/gulu v1.2.3-0.20220909041418-fdfa4d7380bf
|
github.com/88250/gulu v1.2.3-0.20220909041418-fdfa4d7380bf
|
||||||
github.com/88250/lute v1.7.5-0.20220915034356-e5dab9ee72c9
|
github.com/88250/lute v1.7.5-0.20220915112421-e006dc0c88af
|
||||||
github.com/88250/melody v0.0.0-20201115062536-c0b3394adcd1
|
github.com/88250/melody v0.0.0-20201115062536-c0b3394adcd1
|
||||||
github.com/88250/pdfcpu v0.3.13
|
github.com/88250/pdfcpu v0.3.13
|
||||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
||||||
|
@ -19,8 +19,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXS
|
|||||||
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||||
github.com/88250/gulu v1.2.3-0.20220909041418-fdfa4d7380bf h1:q+iiBuKjdvUKj5dQQHCRs+g9oChTWkZmm7r1FMvtkfI=
|
github.com/88250/gulu v1.2.3-0.20220909041418-fdfa4d7380bf h1:q+iiBuKjdvUKj5dQQHCRs+g9oChTWkZmm7r1FMvtkfI=
|
||||||
github.com/88250/gulu v1.2.3-0.20220909041418-fdfa4d7380bf/go.mod h1:I1qBzsksFL2ciGSuqDE7R3XW4BUMrfDgOvSXEk7FsAI=
|
github.com/88250/gulu v1.2.3-0.20220909041418-fdfa4d7380bf/go.mod h1:I1qBzsksFL2ciGSuqDE7R3XW4BUMrfDgOvSXEk7FsAI=
|
||||||
github.com/88250/lute v1.7.5-0.20220915034356-e5dab9ee72c9 h1:VIw3wMkTmA7nMYc2Tj7NGYrlAGRJZ2BADT4/k26tAQw=
|
github.com/88250/lute v1.7.5-0.20220915112421-e006dc0c88af h1:Z74h1d4xMKVN7KnSSQll0UXqCxw+bYwpK1c4dsjaLCE=
|
||||||
github.com/88250/lute v1.7.5-0.20220915034356-e5dab9ee72c9/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
|
github.com/88250/lute v1.7.5-0.20220915112421-e006dc0c88af/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
|
||||||
github.com/88250/melody v0.0.0-20201115062536-c0b3394adcd1 h1:9Cb+iN639vUI2OcIBc+4oGwml9/0J6bL6dWNb8Al+1s=
|
github.com/88250/melody v0.0.0-20201115062536-c0b3394adcd1 h1:9Cb+iN639vUI2OcIBc+4oGwml9/0J6bL6dWNb8Al+1s=
|
||||||
github.com/88250/melody v0.0.0-20201115062536-c0b3394adcd1/go.mod h1:jH6MMPr8G7AMzaVmWHXZQiB1DKO3giWbcWZ7UoJ1teI=
|
github.com/88250/melody v0.0.0-20201115062536-c0b3394adcd1/go.mod h1:jH6MMPr8G7AMzaVmWHXZQiB1DKO3giWbcWZ7UoJ1teI=
|
||||||
github.com/88250/pdfcpu v0.3.13 h1:touMWMZkCGalMIbEg9bxYp7rETM+zwb9hXjwhqi4I7Q=
|
github.com/88250/pdfcpu v0.3.13 h1:touMWMZkCGalMIbEg9bxYp7rETM+zwb9hXjwhqi4I7Q=
|
||||||
|
@ -728,8 +728,6 @@ func GetDoc(startID, endID, id string, index int, keyword string, mode int, size
|
|||||||
subTree.Root.AppendChild(n)
|
subTree.Root.AppendChild(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
treenode.NestedInlines2FlattedSpans(subTree)
|
|
||||||
|
|
||||||
luteEngine.RenderOptions.NodeIndexStart = index
|
luteEngine.RenderOptions.NodeIndexStart = index
|
||||||
dom = luteEngine.Tree2BlockDOM(subTree, luteEngine.RenderOptions)
|
dom = luteEngine.Tree2BlockDOM(subTree, luteEngine.RenderOptions)
|
||||||
return
|
return
|
||||||
|
@ -144,6 +144,10 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
|||||||
// 写回 .sy
|
// 写回 .sy
|
||||||
for _, tree := range trees {
|
for _, tree := range trees {
|
||||||
syPath := filepath.Join(unzipRootPath, tree.Path)
|
syPath := filepath.Join(unzipRootPath, tree.Path)
|
||||||
|
if "" == tree.Root.Spec {
|
||||||
|
treenode.NestedInlines2FlattedSpans(tree)
|
||||||
|
tree.Root.Spec = "1"
|
||||||
|
}
|
||||||
renderer := render.NewJSONRenderer(tree, luteEngine.RenderOptions)
|
renderer := render.NewJSONRenderer(tree, luteEngine.RenderOptions)
|
||||||
data := renderer.Render()
|
data := renderer.Render()
|
||||||
|
|
||||||
@ -451,6 +455,7 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
|
|||||||
tree.Path = targetPath
|
tree.Path = targetPath
|
||||||
targetPaths[curRelPath] = targetPath
|
targetPaths[curRelPath] = targetPath
|
||||||
tree.HPath = hPath
|
tree.HPath = hPath
|
||||||
|
tree.Root.Spec = "1"
|
||||||
treenode.NestedInlines2FlattedSpans(tree)
|
treenode.NestedInlines2FlattedSpans(tree)
|
||||||
|
|
||||||
docDirLocalPath := filepath.Dir(filepath.Join(boxLocalPath, targetPath))
|
docDirLocalPath := filepath.Dir(filepath.Join(boxLocalPath, targetPath))
|
||||||
|
Loading…
Reference in New Issue
Block a user