Skip to content

Commit 5fff3ca

Browse files
authored
fix(FoldingHeading): correct position of separator on bottom edge of section (#322)
1 parent 4564256 commit 5fff3ca

File tree

1 file changed

+9
-6
lines changed
  • src/extensions/yfm/FoldingHeading/plugins

1 file changed

+9
-6
lines changed

src/extensions/yfm/FoldingHeading/plugins/Folding.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ function buildDecosSet(doc: Node): DecorationSet {
142142
const childPos = $pos.posAtIndex(idx, depth);
143143

144144
if (isHeading(child)) {
145-
if (isFoldingHeading(child)) {
145+
const hasFolding = isFoldingHeading(child);
146+
if (hasFolding) {
146147
nextFoldingHeadingFound = true;
147148
}
148149

@@ -153,11 +154,13 @@ function buildDecosSet(doc: Node): DecorationSet {
153154
lastNonHiddenChild = {node: child, pos: childPos, level: hLevel};
154155
}
155156

156-
if (isUnfoldedHeading(child)) {
157-
hLevel = level;
158-
hidden = false;
159-
} else {
160-
hidden = true;
157+
if (hasFolding) {
158+
if (isUnfoldedHeading(child)) {
159+
hLevel = level;
160+
hidden = false;
161+
} else {
162+
hidden = true;
163+
}
161164
}
162165
}
163166

0 commit comments

Comments
 (0)