@@ -232,6 +232,10 @@ export class CodeSnippet extends BaseIconButton implements OnInit, AfterViewInit
232
232
}
233
233
234
234
handleScroll ( ) {
235
+ if ( this . skeleton ) {
236
+ return ;
237
+ }
238
+
235
239
let ref ;
236
240
switch ( this . display ) {
237
241
case "multi" :
@@ -263,7 +267,7 @@ export class CodeSnippet extends BaseIconButton implements OnInit, AfterViewInit
263
267
onCopyButtonClicked ( ) {
264
268
if ( ! this . disabled ) {
265
269
window . navigator . clipboard
266
- . writeText ( this . code . nativeElement . innerText || this . code . nativeElement . textContent ) . then ( ( ) => {
270
+ . writeText ( this . code ) . then ( ( ) => {
267
271
this . showFeedback = true ;
268
272
this . animating = true ;
269
273
setTimeout ( ( ) => {
@@ -276,6 +280,11 @@ export class CodeSnippet extends BaseIconButton implements OnInit, AfterViewInit
276
280
277
281
ngOnInit ( ) {
278
282
this . calculateContainerHeight ( ) ;
283
+ }
284
+
285
+ ngAfterViewInit ( ) {
286
+ this . canExpand ( ) ;
287
+ this . handleScroll ( ) ;
279
288
if ( window ) {
280
289
this . eventService . on ( window as any , "resize" , ( ) => {
281
290
this . canExpand ( ) ;
@@ -284,15 +293,8 @@ export class CodeSnippet extends BaseIconButton implements OnInit, AfterViewInit
284
293
}
285
294
}
286
295
287
- ngAfterViewInit ( ) {
288
- setTimeout ( ( ) => {
289
- this . canExpand ( ) ;
290
- this . handleScroll ( ) ;
291
- } ) ;
292
- }
293
-
294
296
calculateContainerHeight ( ) {
295
- if ( this . display === "multi" ) {
297
+ if ( this . display === "multi" && ! this . skeleton ) {
296
298
this . styles = { } ;
297
299
if ( this . expanded ) {
298
300
if ( this . maxExpandedNumberOfRows > 0 ) {
@@ -313,7 +315,7 @@ export class CodeSnippet extends BaseIconButton implements OnInit, AfterViewInit
313
315
}
314
316
315
317
protected canExpand ( ) {
316
- if ( this . display === "multi" ) {
318
+ if ( this . display === "multi" && ! this . skeleton ) {
317
319
const height = this . codeContent . nativeElement . getBoundingClientRect ( ) . height ;
318
320
if (
319
321
this . maxCollapsedNumberOfRows > 0 &&
0 commit comments