Before asking for help please read "Requesting Help and Suggestions" by clicking on that tab above here.
  • Page:
  • 1

TOPIC:

How to get ckeditor to display iframe tags 1 month 3 weeks ago #1

  • superhappybunnycat
  • superhappybunnycat's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 19
I want to embed an iframe to show a google doc within my stories tab eg:
<iframe src="docs.google.com/document/etcetcetcetc">

ckeditor strips out the tag. I updated the below file and removed "iframe" from the CKEDITOR.config.removePlugins row. This meant the button to insert an iframe now shows, and it appears to work as it adds a little red placeholder image for the iframe, however when you try and save it the iframe is stripped out again. How can I fix it so I can use the iframe?

github.com/fisharebest/webtrees/blob/2.0...tor-js.phtml#L10-L12

Please Log in or Create an account to join the conversation.

How to get ckeditor to display iframe tags 1 month 3 weeks ago #2

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14878
User supplied HTML is filtered on the server before it is saved.

Look at app/Services/HtmlService.php
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

How to get ckeditor to display iframe tags 1 month 3 weeks ago #3

  • superhappybunnycat
  • superhappybunnycat's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 19
Thanks! I found that file and have taken a look, but I can't see any references to iframes that I can remove to stop this from happening?

Please Log in or Create an account to join the conversation.

How to get ckeditor to display iframe tags 1 month 3 weeks ago #4

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14878
That code defines things that are allowed - everything else is blocked.

The code contains two examples of "->addElement()" (map and area).

You'd want something similar for iframes.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

How to get ckeditor to display iframe tags 1 month 3 weeks ago #5

  • superhappybunnycat
  • superhappybunnycat's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 19
Is anyone able to help with what code to use here? I don't know PHP. I tried the below but it's not working (throwing a ton of errors when I try and save with an iframe)

$map = $def->addElement('iframe');

Please Log in or Create an account to join the conversation.

How to get ckeditor to display iframe tags 1 month 3 weeks ago #6

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14878
You need to provide the rest of the parameters to the function.

If you look at the existing code for 'map', it specifies the name of the element (map), the type of HTML (Block), the HTML content that it can contain (Flow), abd then the default attributes (Common), and additional attributes.

You'd probably just need to change the additional attributes. Add in whatever HTML attributes you use on your iframe.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum