Jump to:

22975 Posts in 11620 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Script doesn't stay in editor

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
Go to End
Author Topic: 1506 Views
  • raamklaza
    Avatar
    Community Member
    182 Posts

    Script doesn't stay in editor Link to this post

    I have the following script:

    <div id="heyzap_games_medium" style=""></div>
    <script type="text/javascript" src="http://www.heyzap.com/javascripts/embed.external.js"> </script>
    <style> @import 'http://www.heyzap.com/elightbox/lightbox.external.css'; </style>
    <script type="text/javascript">
    var heyzap_medium = new Heyzap( 'heyzap_games_medium', {"embed_key":"8840962768"} );
    heyzap_medium.renderMini( null, 'medium' );
    </script>
    <a target="_blank" href="http://www.heyzap.com">heyzap.com - embed games</a>

    Why doesn't this kept saved in the wysiwyg editor? I put it in there in HTML mode. For other embedded scripts there is no problem. Only for this one

  • Double-A-Ron
    Avatar
    Community Member
    599 Posts

    Re: Script doesn't stay in editor Link to this post

    The WYSIWYG editor strips many normal HTML tags as a security precaution.

    What is different about this snippet from the others that have been successfully saved? I'm picking that it's the javascript or the @import statement.

    Cheers
    Aaron

  • raamklaza
    Avatar
    Community Member
    182 Posts

    Re: Script doesn't stay in editor Link to this post

    Yes that could be it.

    How can i solve this easily?

    Add an extra field in a Page page with only html ?

  • TotalNet
    Avatar
    Community Member
    181 Posts

    Re: Script doesn't stay in editor Link to this post

    The TinyMCE (the WYSIWYG editor) config has changed a fair bit between SS versions, which version of SS are you working with?

    Also, how are you using these other scripts that work? as far as I can see (in v2.3.2 at least) the script tag is not allowed and will get stripped out. same goes for style.

    TinyMCE can be configured to allow additional tags and attributes, how you do this depends on the version of SS you are running.

    Cheers,

    Rich

  • Double-A-Ron
    Avatar
    Community Member
    599 Posts

    Re: Script doesn't stay in editor Link to this post

    This is a TinyMCE config thing, not SS related.

    Check this out for guidance:
    http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements

    There are also a few posts in the archive forum on this, do a search through that. Here's one that I remember: http://silverstripe.org/archive/show/202803#post202803

    Cheers
    Aaron

  • raamklaza
    Avatar
    Community Member
    182 Posts

    Re: Script doesn't stay in editor Link to this post

    Thnx!

    I found the solution in this topic: http://www.silverstripe.org/archive/show/128480

    Just take out all the elements lol

  • johnnyN
    Avatar
    Community Member
    2 Posts

    Re: Script doesn't stay in editor Link to this post

    this does not work in my version of SS. (ver 2.3.3)

    there is not file named /cms/javascript/tinymce.template.js
    i did find an entry for valid_elements but it was already something like "*

    • "

      and I cannot add a <script> tag, so here is what i did.

      I did find an entry in /cms/code/LeftAndMain.php for valid_elements

      and added ",script[src|type]" to the long list of valid_elements and then did the ?flush=1 thing and it seemed to work.

      hope that helps someone else.

    1506 Views
Page: 1
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.