This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Integration into TinyMCE tip


  1. MatthewGrdinic
    Member

    Hopefully this hasn't already been posted.

    If you want to use this great software with TinyMCE, you'll have to tell TinyMCE the iFrame tags are valid. Otherwise, when you try to submit the form embed code, TinyMCE erases the iFrame tags. See more about this behavior:

    http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements

    Anyway, to get the embed to work, add this to your TinyMCE.init declaration:

    extended_valid_elements : "iframe[height|allowTransparency|frameborder|scrolling|style|border|src|title]a[href|title]"

    Thus, mine looks like this in its entirety:
    tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    content_css : "/main-tinyMCE.css",
    relative_urls : false,
    extended_valid_elements : "iframe[height|allowTransparency|frameborder|scrolling|style|border|src|title]a[href|title]"
    });

    similarly, you could also just use: iframe[*]

    Now when you click the edit HTML button and copy/paste the embed code from the admin section of MachForm, TinyMCE will accept the iFrame tags and properties.

    There is one small issue, perhaps someone can chime in here.

    I loose the:

    In short, TinyMCE rewrites the include:
    <iframe height="756" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none" src="http://10.16.3.84/modules/machform/embed.php?id=1" title=""></iframe>

    into:
    <p><iframe height="756" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none" src="/modules/machform/embed.php?id=1"></iframe></p>

    This doesn't seem to break anything, as both URL's seem to work, but it feels wrong to me. Any ideas?

    Posted 16 years ago #
  2. yuniar

    Great info, thanks for sharing!

    About that path problem... try this, remove relative_urls : false from your init declaration and replace it with convert_urls : false.

    That should preserve all your URL. More info here:
    http://wiki.moxiecode.com/index.php/TinyMCE:FAQ#Paths.2FURL.27s_are_incorrect.2C_I_want_absolute.2Frelative_URLs.3F


    MachForm Founder

    Posted 16 years ago #

RSS feed for this topic

Reply