Jump to content
wes

iframes are being stripped from CKEditor field, even when explicitly allowed

Recommended Posts

Having some issue with getting an iframe to save on a CKeditor text field (2.5.3). Things I've done to explicity allow it:

- added "iframe[*]" to extraAllowedContent

- added "IFrame" to the CKEditor toolbar

- turned off CKEditor ACF

- switched the field's "Content Type" from "Markup/HTML" to "Unknown" 

When pasting in my iframe code (it's a Vimeo embed code), CKEditor shows the iframe placeholder, but after saving the page, it's stripped out. For testing, I tried adding a simpler iframe using CKEditor's iframe toolbar button, but that also gets stripped out after saving.

Anyone experiencing this, or have iframes working with their field?

Share this post


Link to post
Share on other sites

Thanks, Adrian. I'll be sure to try that out. I'm assuming it'll work with 2.5 even though it's not listed in supported versions.

Share this post


Link to post
Share on other sites

Yeah - it definitely works fine it 2.5 - hopefully Ryan will get around to updating the supported versions for it shortly.

Share this post


Link to post
Share on other sites

I'm having this problem as well, and I need iframes for other kinds of content (not just video), so the Video Embed module isn't a solution for me.  

  • Like 1

Share this post


Link to post
Share on other sites

It is definitely possible to allow iframes through CKEditor with the right settings, but I would suggest that the easiest option might be to set up a Hanna Code (http://modules.processwire.com/modules/process-hanna-code/) tag for inserting iframes. I have to head out, but hopefully someone else can give you an example if you can't figure it out.

Share this post


Link to post
Share on other sites

Here's how it worked for me in CKEditor (in case you persist on this route :-) - but I would go for Hanna Code as Adrian suggested. As usual, the "culprit" is our friend HTML Purifier (read from here up to and including Ryan's comment here about its pros and cons before deciding whether to implement #5 below!) 

  • For iframes, the Extra allowed content seems to have no effect - btw, the correct syntax here is for example, div(*) not div[*]
  • Add 'Iframe' (note the spelling) to your CKEditor Toolbar
  • Leave ACF on
  • No need to switch the field's "Content Type" from "Markup/HTML" to "Unknown" 
  • Turn HTML Purifier off (gasp! :undecided:  :-X  :-) )
  • Enjoy your embedded video :D
  • Like 12

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By fruid
      inserting links i.e. <a>-elements, and only links, inside a CKEditor-summary field outputs the link-text and a weird " /> above the content-div (I'm using markup regions).
      I have no idea where this is coming from, all the other tags work perfectly, and the CKEditor-markup is fine too when adding links. It puts the <a>-element inside a <p> element but should be alright?
      Any hints?
    • By fruid
      I doubt nobody has seen this issue before…
      when I have an <h2> or <h3> or the likes in a CKEditor-body-field and I delete that header, the h-tag is applied to whatever comes next in line. I'm obviously talking about the WYSIWYG-view. Similar bugs occur when applying an h-tag, that tag sometimes encloses the next line as well. Could be that this happens when the next line is in the same "block"-element and not technically a new line but separated with a <br> but not always…
      When will a new version of CKEditor for PW be released or what's a competitive alternative at this point?
    • By Liam88
      Hello all,
      I'm having a moment with CKeditor and hoping someone will be able to assist.
      I want to change the structure of the table plugin to automatically add the following:
      Schema.org markup to signify it's a table. Aria-label and roles for each of the table elements. At the moment if I add them in manually, the plugin removes them. I'd like to have this as default.  Here is an example: Additional classes. The plugin has the option for a table ID, but where possible I'd rather use classes. I have searched far and wide on the ol Google but struggling on this. I'm not the most experienced and would appreciate any direction on this.
      It's mainly a case of where best to make said adjustments. 
      Thank you in advance!
      Liam
       
    • By Jennifer Stock
      Hi. Sometimes when I select text in a textarea field outfitted with CK Editor, it fails to register as a "Block Style" and therefore the custom styles I have specified for block-level elements are not displayed in the Styles drop-down menu. If I open the page in an incognito window and select the same elements, the Block Style styles appear as expected in the Styles menu.
      Is this a caching issue of some kind? I've played with turning on and off the HTML "quality assurance" options as well as putting my custom styles directly within the CKEditor folder in the /wire directory. Once the field stops registering the selection of block-level elements, it also seems to have simultaneously stripped the custom styles that had been successfully applied to these block-level elements previously.
      Not sure what to do next.
    • By prestoav
      Hi all and thanks for the great work on PW!

      One thing I find I have to do on any new site is add the Justify plugin to textarea fields as it is such a widely required feature for text headings in content.

      ANy chance this could be added to the core an automatically be installed on new textarea fields using CKEditor?

      Thank you!
×
×
  • Create New...