mirror of
https://github.com/usememos/memos.git
synced 2024-12-26 15:13:10 +08:00
chore: fix find sibling node
This commit is contained in:
parent
454cd4e24f
commit
ce2d37b90c
1 changed files with 2 additions and 2 deletions
|
@ -5,7 +5,7 @@ func FindPrevSiblingExceptLineBreak(node Node) Node {
|
|||
return nil
|
||||
}
|
||||
prev := node.PrevSibling()
|
||||
if prev != nil && prev.Type() == LineBreakNode {
|
||||
if prev != nil && prev.Type() == LineBreakNode && prev.PrevSibling() != nil && prev.PrevSibling().Type() != LineBreakNode {
|
||||
return FindPrevSiblingExceptLineBreak(prev)
|
||||
}
|
||||
return prev
|
||||
|
@ -16,7 +16,7 @@ func FindNextSiblingExceptLineBreak(node Node) Node {
|
|||
return nil
|
||||
}
|
||||
next := node.NextSibling()
|
||||
if next != nil && next.Type() == LineBreakNode {
|
||||
if next != nil && next.Type() == LineBreakNode && next.NextSibling() != nil && next.NextSibling().Type() != LineBreakNode {
|
||||
return FindNextSiblingExceptLineBreak(next)
|
||||
}
|
||||
return next
|
||||
|
|
Loading…
Reference in a new issue