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 +19
-19
lines changed
studio/src/app/helpers/editor Expand file tree Collapse file tree 1 file changed +19
-19
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments