Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions studio/src/app/handlers/editor/events/deck/deck-events.handler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -767,14 +767,23 @@ export class DeckEventsHandler {

let result: string = await cleanContent(content);

if (!slide.hasAttribute('custom-background')) {
result = result.replace(/<div slot="background">(.*?)<\/div>/g, '');
}
result = await this.cleanSlideCustomSlots(slide, result, 'background');
result = await this.cleanSlideCustomSlots(slide, result, 'header');
result = await this.cleanSlideCustomSlots(slide, result, 'footer');

resolve(result);
});
}

private async cleanSlideCustomSlots(slide: HTMLElement, content: string, customAttribute: 'background' | 'header' | 'footer'): Promise<string> {
if (!slide.hasAttribute(`custom-${customAttribute}`)) {
const regex: RegExp = new RegExp(`<div slot="${customAttribute}"(.*?)<\/div>`, 'g');
content = content.replace(regex, '');
}

return content;
}

private filterSlideContentSlots(slide: HTMLElement): Promise<string> {
return new Promise<string>((resolve) => {
if (!slide || !document) {
Expand Down