@@ -34,7 +34,7 @@ export class ConfigClass {
3434 return this . widgets ;
3535 }
3636
37- public async getWidgetsHtml ( zip : JSZip ) {
37+ public async createWidgetsHtml ( zip : JSZip ) {
3838 let htmlWidgets = await Promise . all (
3939 this . widgets . map ( async ( element , index ) => {
4040 const type = element . type ;
@@ -53,15 +53,14 @@ export class ConfigClass {
5353 const inputElement = clone . querySelector ( ".widget-input" ) as HTMLInputElement | null ;
5454
5555 if ( "text" in element && widgetText ) {
56- const sanitized_html = DOMPurify . sanitize ( element . text ) ;
57- widgetText . innerHTML = sanitized_html ;
56+ widgetText . innerHTML = DOMPurify . sanitize ( element . text ) ;
5857 }
5958
6059 if ( type === "switch" ) {
61- ( clone . querySelector ( ".widget-switch-input" ) as HTMLInputElement ) . checked = ! (
62- element . value . default == 0
63- ) ;
64- } else if ( type === "slider" || type === "number" ) {
60+ ( clone . querySelector ( ".widget-switch-input" ) as HTMLInputElement ) . checked = element . value . default ;
61+ }
62+
63+ else if ( type === "slider" || type === "number" ) {
6564 const widgetValue = clone . querySelector ( ".widget-value-text" ) as HTMLElement | null ;
6665 if ( element . value . default !== undefined ) {
6766 inputElement ! . valueAsNumber = element . value . default ;
@@ -81,7 +80,9 @@ export class ConfigClass {
8180 }
8281
8382 inputElement ! . addEventListener ( "input" , updateDisplayedValue ) ;
84- } else if ( type === "image" ) {
83+ }
84+
85+ else if ( type === "image" ) {
8586 const imageFile = await zip . file ( element . file ) ?. async ( "blob" ) ;
8687 if ( imageFile ) {
8788 ( clone . querySelector ( ".widget-image" ) as HTMLImageElement ) . src =
0 commit comments