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 = {
60
60
P : ( ) => ( { type : 'p' , attrs : { } } ) ,
61
61
PRE : ( ) => ( { type : 'code' , attrs : { } } ) ,
62
62
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
+ } ,
64
72
TABLE : ( el : HTMLElement ) => ( { type : 'table' , attrs : { } } ) ,
65
73
THEAD : ( el : HTMLElement ) => ( { type : 'thead' , attrs : { } } ) ,
66
74
TBODY : ( el : HTMLElement ) => ( { type : 'tbody' , attrs : { } } ) ,
Original file line number Diff line number Diff line change @@ -185,6 +185,9 @@ const ELEMENT_TYPES: IJsonToHtmlElementTags = {
185
185
} ,
186
186
script : ( attrs : any , child : any ) => {
187
187
return `<script ${ attrs } >${ child } </script>`
188
+ } ,
189
+ "social-embeds" : ( attrs : any , child : any ) => {
190
+ return `<iframe${ attrs } data-type="social-embeds" ></iframe>`
188
191
}
189
192
}
190
193
const TEXT_WRAPPERS : IJsonToHtmlTextTags = {
You can’t perform that action at this time.
0 commit comments