1

I need to support embedded tweets in Facebook Instant Articles. Oob the way to do that is to wrap Twitter's embed code blockquote.twitter-tweet in figure.op-interactive iframe (here's a link to Facebook's documentation, for reference) —

<figure class="op-interactive">
  <iframe>
    <blockquote class="twitter-tweet"...</blockquote>
  </iframe>
</figure>

I planned to add those wrapping elements via the "source" view of the rich text field, but when I save EE escapes the < and > inside the iframe as &lt; and &gt;

<figure class="op-interactive">
  <iframe>
    &lt;blockquote class="twitter-tweet"...&lt;/blockquote&gt;
  </iframe>
</figure>

Is there a way to include markup inside an iframe in the rich text editor?

Or does anyone have a favorite workaround? Or a plugin that could be added to this large existing site without adding tooo much migration overhead and without significantly changing the client's content entry experience?

This site is on EE 2.9 if that makes a difference.

0

2 Answers 2

2

I solved something simulair with https://devot-ee.com/add-ons/low-replace, an addon from LOW. I wanted special markup for any <a href in the RTF field. It works like a charm!

In my case like this:

{exp:low_replace find="<a "
                 replace="<a class='lightview'
                            data-lightview-type='iframe'"
}
  {My_RTFText_Field}
{/exp:low_replace}
2
  • This looks really promising, I'll check it out
    – henry
    Feb 21, 2017 at 16:28
  • 1
    Perfect! For anyone else who tries out Low Replace, beware it currently has a little trouble dealing with escaped / (ie \/) in regex searches - in my case I was able to just use .
    – henry
    Feb 22, 2017 at 23:24
0

You shouldn't use rich text editor for this as it will convert the HTML tags for sure. Try using TextArea field instead.

2
  • Thanks for the suggestion. Unfortunately this is not an option on this site: the client needs the rich text editor for ease of content entry
    – henry
    Feb 15, 2017 at 17:00
  • Well, You should Use Rich text editor for other contents and textArea for Iframe only. If Iframe comes in the middle of the content, You can split All the content in 3 fields i.e., "Top Body Editor, Iframe TextArea, Bottom Body Editor" Feb 16, 2017 at 5:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.