@@ -110,10 +110,16 @@ export class EditorHelper {
110110
111111 this . deckBusyService . busy ( true ) ;
112112
113- const persistedSlide : Slide = await this . slideService . post ( {
114- slide_template : SlideTemplate . TITLE ,
115- slide_content : slide . innerHTML
116- } ) ;
113+ const slidePost : Slide = {
114+ slide_template : SlideTemplate . TITLE
115+ } ;
116+
117+ const content : string = await this . cleanSlideContent ( slide . innerHTML ) ;
118+ if ( content && content . length > 0 ) {
119+ slidePost . slide_content = content
120+ }
121+
122+ const persistedSlide : Slide = await this . slideService . post ( slidePost ) ;
117123
118124 if ( persistedSlide && persistedSlide . slide_id ) {
119125 slide . setAttribute ( 'slide_id' , persistedSlide . slide_id ) ;
@@ -179,10 +185,14 @@ export class EditorHelper {
179185
180186 const slideUpdate : Slide = {
181187 slide_id : slide . getAttribute ( 'slide_id' ) ,
182- slide_template : SlideTemplate . TITLE ,
183- slide_content : slide . innerHTML
188+ slide_template : SlideTemplate . TITLE
184189 } ;
185190
191+ const content : string = await this . cleanSlideContent ( slide . innerHTML ) ;
192+ if ( content && content . length > 0 ) {
193+ slideUpdate . slide_content = content
194+ }
195+
186196 const attributes : SlideAttributes = await this . getSlideAttributes ( slide ) ;
187197
188198 if ( attributes && Object . keys ( attributes ) . length > 0 ) {
@@ -261,4 +271,19 @@ export class EditorHelper {
261271 resolve ( attributes ) ;
262272 } )
263273 }
274+
275+ private cleanSlideContent ( content : string ) : Promise < string > {
276+ return new Promise < string > ( ( resolve ) => {
277+ if ( ! content || content . length <= 0 ) {
278+ resolve ( content ) ;
279+ return ;
280+ }
281+
282+ let result : string = content . replace ( / d e c k g o - u n t o u c h e d | c o n t e n t e d i t a b l e = " " | c o n t e n t e d i t a b l e = " t r u e " | c o n t e n t e d i t a b l e / gi, '' ) ;
283+ result = result . replace ( / c l a s s = " " / g, '' ) ;
284+ result = result . replace ( / \s \s + / g, '' ) ;
285+
286+ resolve ( result ) ;
287+ } ) ;
288+ }
264289}
0 commit comments