Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » TinyMCE strips my code

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3 4
Go to End
Author Topic: 12339 Views
  • banal
    Avatar
    Community Member
    901 Posts

    Re: TinyMCE strips my code Link to this post

    Hmm. I think that's not really easy to do.
    Could you post your code (the one you insert) and the code that is outputted after you save?

  • SerenityIT
    Avatar
    Community Member
    13 Posts

    Re: TinyMCE strips my code Link to this post

    Trying to get these two bits of code working, and so far all suggestions of commenting lines out aren't working... (trying to integrate another php based application into silverstripe in a simple fashion.

    <script language="JavaScript">
    <!--
    function autoResize(id){
    var newheight;
    var newwidth;

    if(document.getElementById){
    newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
    newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;
    }

    document.getElementById(id).height= (newheight) + "px";
    document.getElementById(id).width= (newwidth) + "px";
    }
    //-->
    </script>

    <iframe src="../helpdesk" width="100%" height="200px" id="iframe1" marginheight="0" frameborder="0" onLoad="autoResize('iframe1');">
    <p>Your browser does not support iframes. Please contact IT.</p>
    </iframe>

  • Darkfaythe
    Avatar
    Community Member
    6 Posts

    Re: TinyMCE strips my code Link to this post

    Hi.

    I'm not sure if its tinymce or what that is causing onmouseover and onclick actions still to be stripped from my html code.

    I have made all the suggested changes the banal put in

    eg:

    Oh yeah, a small addition to my previous post and something that will help both Daniel and Thomas:
    The culprit here is the jsparty/tiny_mce_improvements.js file. There you'll find the sapphiremce_cleanup function that seems to clean up content in addition to the cleaning performed by tinymce. So.. in addition to allow certain elements (using valid_elements) or setting verify_html to false, you must change the tiny_mce_improvements.js file:

    To enable onclick on links, you should remove (comment out) this line:

    value = value.replace(/([ \f\r\t\n\'\"])on[a-z]+=[^ >]+/ig, "$1");

    To allow blocks of JavaScript, you have to allow comments by removing the following line:

    // Word comments
    value = value.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), "");

    but I still cant get any actions to remain in my tags like

    <a onmouseover="popup('This explains nothing, but shows off something.')">this is mine</a> is still stripped to

    <a>this is mine</a>

    and

    <a href="images/image-1.jpg" rel="lightbox"><img src="images/thumb-1.jpg" width="100" height="40" alt="" /></a>

    is still striped to

    <a href="images/image-1.jpg"><img src="images/thumb-1.jpg" width="100" height="40" alt="" /></a>

    I'm using Silverstripe 2.4.7 and I have swfupload and dataobject-manager included

    An help would be greatly appreciated.

    Cheers

    12339 Views
Page: 1 2 3 4
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.