This repository was archived by the owner on Feb 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
studio/src/app/components/editor/slide/app-slide-thumbnail Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ export class AppSlideThumbnail {
6464 const content : string = await cleanContent ( this . slide . outerHTML ) ;
6565
6666 this . deckPreviewRef . innerHTML = content ;
67+
68+ await Promise . all ( [ this . lazyLoadImages ( ) , this . lazyLoadCharts ( ) ] ) ;
6769 }
6870
6971 private async blockSlide ( $event : CustomEvent ) {
@@ -72,6 +74,24 @@ export class AppSlideThumbnail {
7274 await this . deckPreviewRef ?. blockSlide ( true ) ;
7375 }
7476
77+ private async lazyLoadImages ( ) {
78+ const images : NodeListOf < HTMLDeckgoLazyImgElement > = this . deckPreviewRef . querySelectorAll ( 'deckgo-lazy-img' ) ;
79+ const promises : Promise < void > [ ] = Array . from ( images ) . map ( ( img : HTMLDeckgoLazyImgElement ) => {
80+ img . customLoader = true ;
81+ return img . lazyLoad ( ) ;
82+ } ) ;
83+ await Promise . all ( promises ) ;
84+ }
85+
86+ private async lazyLoadCharts ( ) {
87+ const imgs : NodeListOf < HTMLDeckgoSlideChartElement > = this . deckPreviewRef . querySelectorAll ( 'deckgo-slide-chart' ) ;
88+ const promises : Promise < void > [ ] = Array . from ( imgs ) . map ( ( img : HTMLDeckgoSlideChartElement ) => {
89+ img . customLoader = true ;
90+ return img . lazyLoadContent ( ) ;
91+ } ) ;
92+ await Promise . all ( promises ) ;
93+ }
94+
7595 render ( ) {
7696 return < Host > { this . renderMiniature ( ) } </ Host > ;
7797 }
You can’t perform that action at this time.
0 commit comments