File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,15 @@ export const ELEMENT_TAGS: IHtmlToJsonElementTags = {
6060 P : ( ) => ( { type : 'p' , attrs : { } } ) ,
6161 PRE : ( ) => ( { type : 'code' , attrs : { } } ) ,
6262 UL : ( ) => ( { type : 'ul' , attrs : { } } ) ,
63- IFRAME : ( el : HTMLElement ) => ( { type : 'embed' , attrs : { src : el . getAttribute ( 'src' ) } } ) ,
63+ IFRAME : ( el : HTMLElement ) => {
64+ if ( el . getAttribute ( 'data-type' ) === "social-embeds" ) {
65+ const src = el . getAttribute ( 'src' )
66+ el . removeAttribute ( 'data-type' )
67+ el . removeAttribute ( 'src' )
68+ return { type : 'social-embeds' , attrs : { src } }
69+ }
70+ return { type : 'embed' , attrs : { src : el . getAttribute ( 'src' ) } }
71+ } ,
6472 TABLE : ( el : HTMLElement ) => ( { type : 'table' , attrs : { } } ) ,
6573 THEAD : ( el : HTMLElement ) => ( { type : 'thead' , attrs : { } } ) ,
6674 TBODY : ( el : HTMLElement ) => ( { type : 'tbody' , attrs : { } } ) ,
Original file line number Diff line number Diff line change @@ -185,6 +185,9 @@ const ELEMENT_TYPES: IJsonToHtmlElementTags = {
185185 } ,
186186 script : ( attrs : any , child : any ) => {
187187 return `<script ${ attrs } >${ child } </script>`
188+ } ,
189+ "social-embeds" : ( attrs : any , child : any ) => {
190+ return `<iframe${ attrs } data-type="social-embeds" ></iframe>`
188191 }
189192}
190193const TEXT_WRAPPERS : IJsonToHtmlTextTags = {
You can’t perform that action at this time.
0 commit comments