Skip to content

Commit

Permalink
🎨 IR Block 大纲接口只渲染根一层
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Sep 24, 2020
1 parent 1342f66 commit 1c31e3d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion javascript/lute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion javascript/lute.min.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions vditor_ir_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ func (lute *Lute) VditorIRBlockDOMHeadings(htmlStr string) (ret string) {
headings := tree.Root.ChildrenByType(ast.NodeHeading)
buf := &bytes.Buffer{}
for _, heading := range headings {
if tree.Root != heading.Parent {
continue
}

padding := 16 + 14*(heading.HeadingLevel-1)
buf.WriteString(`<div data-id="ir-` + render.HeadingID(heading) + `" style="padding-left:` + strconv.Itoa(padding) +
`px" class="b3-list-item">` + heading.Text() + `</div>`)
Expand Down

0 comments on commit 1c31e3d

Please sign in to comment.