@@ -5,16 +5,12 @@ import {svg} from '../svg.js';
5
5
// The fold arrow is the icon displayed on the upper left of the file box, especially intended for components having the 'fold-file' class.
6
6
// The file content box is the box that should be hidden or shown, especially intended for components having the 'file-content' class.
7
7
//
8
- export function setFileFolding ( fileContentBox , foldArrow , newFold ) {
9
- foldArrow . innerHTML = svg ( `octicon-chevron-${ newFold ? 'right' : 'down' } ` , 18 ) ;
10
- fileContentBox . setAttribute ( 'data-folded' , newFold ) ;
11
- }
12
-
13
- // Like `setFileFolding`, except that it automatically inverts the current file folding state.
14
- export function invertFileFolding ( fileContentBox , foldArrow , isFromViewed = false ) {
8
+ export function setFileFolding ( fileContentBox , foldArrow , newFold , isFromViewed = false ) {
15
9
const diffFileHeader = fileContentBox . querySelector ( '.diff-file-header' ) ;
16
10
const isFolded = fileContentBox . getAttribute ( 'data-folded' ) ;
17
- setFileFolding ( fileContentBox , foldArrow , isFolded !== 'true' ) ;
11
+ console . log ( 'newFold' , newFold )
12
+ foldArrow . innerHTML = svg ( `octicon-chevron-${ newFold ? 'right' : 'down' } ` , 18 ) ;
13
+ fileContentBox . setAttribute ( 'data-folded' , newFold ) ;
18
14
// scroll position needs to be adjusted only when folding the file
19
15
// and scrollY is greater than current file header's offsetTop
20
16
if ( isFolded === 'false' && window . scrollY > diffFileHeader . offsetTop ) {
@@ -31,3 +27,8 @@ export function invertFileFolding(fileContentBox, foldArrow, isFromViewed = fals
31
27
} ) ;
32
28
}
33
29
}
30
+
31
+ // Like `setFileFolding`, except that it automatically inverts the current file folding state.
32
+ export function invertFileFolding ( fileContentBox , foldArrow ) {
33
+ setFileFolding ( fileContentBox , foldArrow , fileContentBox . getAttribute ( 'data-folded' ) !== 'true' ) ;
34
+ }
0 commit comments