@@ -7,13 +7,12 @@ import {svg} from '../svg.js';
7
7
//
8
8
export function setFileFolding ( fileContentBox , foldArrow , newFold , isFromViewed = false ) {
9
9
const diffFileHeader = fileContentBox . querySelector ( '.diff-file-header' ) ;
10
- const isFolded = fileContentBox . getAttribute ( 'data-folded' ) ;
11
- console . log ( 'newFold' , newFold )
10
+ console . log ( 'newFold:' , newFold )
12
11
foldArrow . innerHTML = svg ( `octicon-chevron-${ newFold ? 'right' : 'down' } ` , 18 ) ;
13
12
fileContentBox . setAttribute ( 'data-folded' , newFold ) ;
14
13
// scroll position needs to be adjusted only when folding the file
15
14
// and scrollY is greater than current file header's offsetTop
16
- if ( isFolded === 'false ' && window . scrollY > diffFileHeader . offsetTop ) {
15
+ if ( newFold === 'true ' && window . scrollY > diffFileHeader . offsetTop ) {
17
16
// if the file is folded by clicking the "fold file" icon, scroll to current file header
18
17
let scrollTargetoffsetTop = fileContentBox . offsetTop ;
19
18
if ( isFromViewed ) {
@@ -29,6 +28,7 @@ export function setFileFolding(fileContentBox, foldArrow, newFold, isFromViewed
29
28
}
30
29
31
30
// Like `setFileFolding`, except that it automatically inverts the current file folding state.
32
- export function invertFileFolding ( fileContentBox , foldArrow ) {
31
+ export function invertFileFolding ( fileContentBox , foldArrow ) {
33
32
setFileFolding ( fileContentBox , foldArrow , fileContentBox . getAttribute ( 'data-folded' ) !== 'true' ) ;
34
33
}
34
+
0 commit comments