We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41018
    • 3 Posts
    Hi, I'm having a weird issue with the TinyMCE plugin in modx. I'm trying to add a video from youtube, so I use the "embedded media" button, and then i choose "iframe" in the type list. The trouble is that instead of including an iframe on the page, the output is an 'embed' tag...

    And when I look in the HTML source, the tag is an `<iframe>`. So I guess it's some kind of filter on save that replace the iframe with an embed

    Anyone have any clue about this ? [ed. note: sboudrias last edited this post 14 years, 1 month ago.]
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      TinyMCE replaces iframe with embed as a security precaution. You can add the iframe and its attributes using http://www.tinymce.com/wiki.php/Configuration:extended_valid_elements

      iframe[src|title|width|height|allowfullscreen|frameborder]
      
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 41018
        • 3 Posts
        Hey, thanks for your answer. I added this setting to the `xconfig.js` in the `assets/components/tinymce` folder. But this don't seems like working... Any idea ?

        var tinymce_extended_valid_elements = ""
        +'iframe[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress'
        	+'|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style'
        	+'|src|title|width|height|allowfullscreen|frameborder]';
        
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Looks like your quotes are wrong. Try fixing it so that it's all just in single quotes, without that extra set of double-quotes.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 41018
            • 3 Posts
            Others line in the configuration file are setup like this too. And, this is javascript, and the above code is valid JS. But, I tested it anyway, and it isn't working.

            Can the manager tinymce config file not be the one I edited ?
              • 40395
              • 67 Posts
              To confirm - is the file that needs the amend the 'xconfig.js' file ? The tinymce site is unclear.

              I'm also struggling to embed a youtube video. If I turn tinymce off it will work, but when I edit the page again the embed code is lost.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                TinyMCE is a big problem in some circumstances; the only options you have are to either not use it on that resource, or put the sensitive part in a chunk and have the chunk tags in the content edited by TinyMCE. If you enclose the chunk tags in HTML div tags, TinyMCE won't add the extraneous p tags.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 40395
                  • 67 Posts
                  Quote from: sottwell at Oct 25, 2012, 01:35 PM
                  TinyMCE is a big problem in some circumstances; the only options you have are to either not use it on that resource, or put the sensitive part in a chunk and have the chunk tags in the content edited by TinyMCE. If you enclose the chunk tags in HTML div tags, TinyMCE won't add the extraneous p tags.

                  Oddly (?) I don't seem to be able to turn off TinyMCE on that page. I set it to 'off' & save but the next time the page is edited it defaults back to 'on' - loosing any amends.

                  In the end I've hosted the video's on the server but may need to swap back to youtube or similar if bandwidth becomes an issue.