File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
src/extensions/yfm/FoldingHeading/plugins Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments