diff --git a/src/fromRedactor.tsx b/src/fromRedactor.tsx index 3371cd2..525f27a 100644 --- a/src/fromRedactor.tsx +++ b/src/fromRedactor.tsx @@ -60,7 +60,15 @@ export const ELEMENT_TAGS: IHtmlToJsonElementTags = { P: () => ({ type: 'p', attrs: {} }), PRE: () => ({ type: 'code', attrs: {} }), UL: () => ({ type: 'ul', attrs: {} }), - IFRAME: (el: HTMLElement) => ({ type: 'embed', attrs: { src: el.getAttribute('src') } }), + IFRAME: (el: HTMLElement) => { + if(el.getAttribute('data-type') === "social-embeds") { + const src = el.getAttribute('src') + el.removeAttribute('data-type') + el.removeAttribute('src') + return { type: 'social-embeds', attrs: { src } } + } + return { type: 'embed', attrs: { src: el.getAttribute('src') } } + }, TABLE: (el: HTMLElement) => ({ type: 'table', attrs: {} }), THEAD: (el: HTMLElement) => ({ type: 'thead', attrs: {} }), TBODY: (el: HTMLElement) => ({ type: 'tbody', attrs: {} }), diff --git a/src/toRedactor.tsx b/src/toRedactor.tsx index ce486b6..f285831 100644 --- a/src/toRedactor.tsx +++ b/src/toRedactor.tsx @@ -185,6 +185,9 @@ const ELEMENT_TYPES: IJsonToHtmlElementTags = { }, script: (attrs: any, child: any) => { return `` + }, + "social-embeds": (attrs: any, child: any) => { + return `` } } const TEXT_WRAPPERS: IJsonToHtmlTextTags = {