Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 96cdfd7

Browse files
fix: slide put prop
1 parent d477777 commit 96cdfd7

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

studio/src/app/helpers/editor/editor.helper.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -177,31 +177,15 @@ export class EditorHelper {
177177
return;
178178
}
179179

180-
let attributes: SlideAttributes;
181-
182-
if (slide.getAttribute('style')) {
183-
attributes = {
184-
style: slide.getAttribute('style')
185-
};
186-
}
187-
188-
if (slide.getAttribute('src')) {
189-
if (!attributes) {
190-
attributes = {
191-
src: slide.getAttribute('style')
192-
};
193-
} else {
194-
attributes.src = slide.getAttribute('src');
195-
}
196-
}
197-
198180
const slideUpdate: Slide = {
199181
slide_id: slide.getAttribute('slide_id'),
200182
slide_template: SlideTemplate.TITLE,
201183
slide_content: slide.innerHTML
202184
};
203185

204-
if (attributes) {
186+
const attributes: SlideAttributes = await this.getSlideAttributes(slide);
187+
188+
if (attributes && Object.keys(attributes).length > 0) {
205189
slideUpdate.slide_attributes = attributes;
206190
}
207191

@@ -261,4 +245,20 @@ export class EditorHelper {
261245
resolve();
262246
});
263247
}
248+
249+
private getSlideAttributes(slide: HTMLElement): Promise<SlideAttributes> {
250+
return new Promise<SlideAttributes>((resolve) => {
251+
let attributes: SlideAttributes = {};
252+
253+
if (slide.getAttribute('style')) {
254+
attributes.style = slide.getAttribute('style');
255+
}
256+
257+
if ((slide as any).src) {
258+
attributes.src = (slide as any).src;
259+
}
260+
261+
resolve(attributes);
262+
})
263+
}
264264
}

0 commit comments

Comments
 (0)