@@ -44,6 +44,8 @@ export class DeckdeckgoSlideCode implements DeckdeckgoSlide {
4444 this . slideDidLoad . emit ( ) ;
4545
4646 await this . moveSlots ( ) ;
47+
48+ await this . showInfo ( ) ;
4749 }
4850
4951 private moveSlots ( ) : Promise < void > {
@@ -60,6 +62,40 @@ export class DeckdeckgoSlideCode implements DeckdeckgoSlide {
6062 } ) ;
6163 }
6264
65+ private showInfo ( ) : Promise < void > {
66+ return new Promise < void > ( ( resolve ) => {
67+ // Only on mobile devices
68+ if ( DeckdeckgoUtils . isMobile ( ) ) {
69+ const info : HTMLElement = this . el . querySelector ( '[slot=\'info\']' ) ;
70+
71+ if ( info ) {
72+ info . classList . add ( 'deckgo-show-info' ) ;
73+ }
74+ }
75+
76+ resolve ( ) ;
77+ } ) ;
78+ }
79+
80+ private hideInfo ( ) : Promise < boolean > {
81+ return new Promise < boolean > ( ( resolve ) => {
82+ // Only on mobile devices
83+ if ( DeckdeckgoUtils . isMobile ( ) ) {
84+ const info : HTMLElement = this . el . querySelector ( '[slot=\'info\']' ) ;
85+
86+ if ( info && info . classList . contains ( 'deckgo-show-info' ) ) {
87+ info . classList . remove ( 'deckgo-show-info' ) ;
88+ info . style . setProperty ( 'pointer-events' , 'none' ) ;
89+
90+ resolve ( true ) ;
91+ return ;
92+ }
93+ }
94+
95+ resolve ( false ) ;
96+ } ) ;
97+ }
98+
6399 @Method ( )
64100 beforeSwipe ( _enter : boolean ) : Promise < boolean > {
65101 return new Promise < boolean > ( async ( resolve ) => {
@@ -130,13 +166,20 @@ export class DeckdeckgoSlideCode implements DeckdeckgoSlide {
130166 }
131167
132168 private switchAction ( ) : Promise < void > {
133- return new Promise < void > ( ( resolve ) => {
169+ return new Promise < void > ( async ( resolve ) => {
134170 if ( ! this . mobile ) {
135171 // Scrolling is allowed on not mobile devices
136172 resolve ( ) ;
137173 return ;
138174 }
139175
176+ const infoRemoved : boolean = await this . hideInfo ( ) ;
177+ if ( infoRemoved ) {
178+ // On the first click, we just want to hide the info
179+ resolve ( ) ;
180+ return ;
181+ }
182+
140183 this . action = this . action === DeckdeckgoSlideCodeAction . SWIPE ? DeckdeckgoSlideCodeAction . SCROLL : DeckdeckgoSlideCodeAction . SWIPE ;
141184
142185 this . scrolling . emit ( this . action === DeckdeckgoSlideCodeAction . SCROLL ) ;
@@ -176,6 +219,7 @@ export class DeckdeckgoSlideCode implements DeckdeckgoSlide {
176219 < deckgo-highlight-code src = { this . src } anchor = { this . anchor } anchorZoom = { this . anchorZoom } hideAnchor = { this . hideAnchor } language = { this . language } > </ deckgo-highlight-code >
177220 </ div >
178221 < slot name = "code" > </ slot >
222+ < slot name = "info" > </ slot >
179223 < slot name = "notes" > </ slot >
180224 </ div > ;
181225 }
0 commit comments