@@ -72,7 +72,8 @@ export class SBController {
7272 public previousViewMode : string = '' ;
7373 public viewModeChanged : boolean = false ;
7474 public resizeTimer : number = 0 ;
75-
75+ public prevSampleName : string = '' ;
76+ public prevControlName : string = '' ;
7677 //Bread Crumb Object
7778 public breadCrumbObject :
7879 {
@@ -280,7 +281,6 @@ export class SBController {
280281 } )
281282 . subscribe ( ( event : any ) => {
282283 this . updateSourceCode ( location . hash ) ;
283- this . updateDescription ( ) ;
284284 this . setListItemSelect ( ) ;
285285 this . createOpenNewButton ( ) ;
286286 this . updateViewMode ( ) ;
@@ -292,6 +292,10 @@ export class SBController {
292292 if ( this . currentControl !== this . prevControl ) {
293293 this . updateListViewDS ( ) ;
294294 }
295+ this . setScrollTop ( ) ;
296+ if ( this . prevSampleName !== this . sampleName || this . currentControl !== this . prevControl ) {
297+ this . updateDescription ( ) ;
298+ }
295299 } ) ;
296300
297301 this . router . events
@@ -317,6 +321,8 @@ export class SBController {
317321 localStorage . removeItem ( 'pointer' ) ;
318322 }
319323 this . isInitialRender = false ;
324+ this . prevSampleName = this . sampleName ;
325+ this . prevControlName = this . currentControl ;
320326 } ) ;
321327 }
322328
@@ -558,7 +564,7 @@ export class SBController {
558564
559565 onChangeTheme ( e : Event ) {
560566 let target : Element = < HTMLElement > e . target ;
561- target = closest ( target , '.e-list' ) ;
567+ target = closest ( target , '.e-list' ) ;
562568 let themeName : string = target . id ;
563569 this . switchTheme ( themeName ) ;
564570 this . themePopup . hide ( ) ;
@@ -747,6 +753,15 @@ export class SBController {
747753 }
748754 }
749755
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+
750765 updateSourceCode ( path : string ) : void {
751766 let pathArray : string [ ] = path . split ( '/' ) ;
752767 pathArray = pathArray . slice ( 2 ) ;
@@ -777,11 +792,11 @@ export class SBController {
777792 let content : string = res . _body
778793 if ( / h t m l / g. test ( fileName ) ) {
779794 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)
783796 }
784797 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, '>' )
785800 items . push ( {
786801 header : { text : fileName } ,
787802 data : content ,
0 commit comments