@@ -72,7 +72,8 @@ export class SBController {
72
72
public previousViewMode : string = '' ;
73
73
public viewModeChanged : boolean = false ;
74
74
public resizeTimer : number = 0 ;
75
-
75
+ public prevSampleName : string = '' ;
76
+ public prevControlName : string = '' ;
76
77
//Bread Crumb Object
77
78
public breadCrumbObject :
78
79
{
@@ -280,7 +281,6 @@ export class SBController {
280
281
} )
281
282
. subscribe ( ( event : any ) => {
282
283
this . updateSourceCode ( location . hash ) ;
283
- this . updateDescription ( ) ;
284
284
this . setListItemSelect ( ) ;
285
285
this . createOpenNewButton ( ) ;
286
286
this . updateViewMode ( ) ;
@@ -292,6 +292,10 @@ export class SBController {
292
292
if ( this . currentControl !== this . prevControl ) {
293
293
this . updateListViewDS ( ) ;
294
294
}
295
+ this . setScrollTop ( ) ;
296
+ if ( this . prevSampleName !== this . sampleName || this . currentControl !== this . prevControl ) {
297
+ this . updateDescription ( ) ;
298
+ }
295
299
} ) ;
296
300
297
301
this . router . events
@@ -317,6 +321,8 @@ export class SBController {
317
321
localStorage . removeItem ( 'pointer' ) ;
318
322
}
319
323
this . isInitialRender = false ;
324
+ this . prevSampleName = this . sampleName ;
325
+ this . prevControlName = this . currentControl ;
320
326
} ) ;
321
327
}
322
328
@@ -558,7 +564,7 @@ export class SBController {
558
564
559
565
onChangeTheme ( e : Event ) {
560
566
let target : Element = < HTMLElement > e . target ;
561
- target = closest ( target , '.e-list' ) ;
567
+ target = closest ( target , '.e-list' ) ;
562
568
let themeName : string = target . id ;
563
569
this . switchTheme ( themeName ) ;
564
570
this . themePopup . hide ( ) ;
@@ -747,6 +753,15 @@ export class SBController {
747
753
}
748
754
}
749
755
756
+ setScrollTop ( ) {
757
+ let rightPane : HTMLElement = < HTMLElement > select ( '.sb-right-pane' ) ;
758
+ if ( this . isMobile ) {
759
+ rightPane . scrollTop = 74 ;
760
+ } else {
761
+ rightPane . scrollTop = 0 ;
762
+ }
763
+ }
764
+
750
765
updateSourceCode ( path : string ) : void {
751
766
let pathArray : string [ ] = path . split ( '/' ) ;
752
767
pathArray = pathArray . slice ( 2 ) ;
@@ -777,11 +792,11 @@ export class SBController {
777
792
let content : string = res . _body
778
793
if ( / h t m l / g. test ( fileName ) ) {
779
794
content = this . getStringWithOutDescription ( content , / ( \' | \" ) d e s c r i p t i o n / g) ;
780
- content = this . getStringWithOutDescription ( content , / ( \' | \" ) a c t i o n - d e s c r i p t i o n / g)
781
- content = content . replace ( / & / g, '&' )
782
- . replace ( / " / g, '"' ) . replace ( / < / g, '<' ) . replace ( / > / g, '>' )
795
+ content = this . getStringWithOutDescription ( content , / ( \' | \" ) a c t i o n - d e s c r i p t i o n / g)
783
796
}
784
797
if ( ! / - p l n k r \. j s o n / g. test ( fileName ) ) {
798
+ content = content . replace ( / & / g, '&' )
799
+ . replace ( / " / g, '"' ) . replace ( / < / g, '<' ) . replace ( / > / g, '>' )
785
800
items . push ( {
786
801
header : { text : fileName } ,
787
802
data : content ,
0 commit comments