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 +12
-3
lines changed
studio/src/app/handlers/editor/events/deck Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -767,14 +767,23 @@ export class DeckEventsHandler {
767767
768768 let result : string = await cleanContent ( content ) ;
769769
770- if ( ! slide . hasAttribute ( 'custom- background') ) {
771- result = result . replace ( / < d i v s l o t = " b a c k g r o u n d " > ( . * ? ) < \/ d i v > / g , '' ) ;
772- }
770+ result = await this . cleanSlideCustomSlots ( slide , result , ' background') ;
771+ result = await this . cleanSlideCustomSlots ( slide , result , 'header ' ) ;
772+ result = await this . cleanSlideCustomSlots ( slide , result , 'footer' ) ;
773773
774774 resolve ( result ) ;
775775 } ) ;
776776 }
777777
778+ private async cleanSlideCustomSlots ( slide : HTMLElement , content : string , customAttribute : 'background' | 'header' | 'footer' ) : Promise < string > {
779+ if ( ! slide . hasAttribute ( `custom-${ customAttribute } ` ) ) {
780+ const regex : RegExp = new RegExp ( `<div slot="${ customAttribute } "(.*?)<\/div>` , 'g' ) ;
781+ content = content . replace ( regex , '' ) ;
782+ }
783+
784+ return content ;
785+ }
786+
778787 private filterSlideContentSlots ( slide : HTMLElement ) : Promise < string > {
779788 return new Promise < string > ( ( resolve ) => {
780789 if ( ! slide || ! document ) {
You can’t perform that action at this time.
0 commit comments