Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

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

Script doesn't stay in editor


Reply

7 Posts   1613 Views

Avatar
raamklaza

7 July 2009 at 7:43am Community Member, 182 Posts

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

Avatar
Double-A-Ron

7 July 2009 at 12:34pm (Last edited: 7 July 2009 12:34pm), Community Member, 604 Posts

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

Avatar
raamklaza

7 July 2009 at 9:28pm Community Member, 182 Posts

Yes that could be it.

How can i solve this easily?

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

Avatar
TotalNet

8 July 2009 at 2:12pm Community Member, 181 Posts

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

Avatar
Double-A-Ron

8 July 2009 at 2:27pm (Last edited: 8 July 2009 2:28pm), Community Member, 604 Posts

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

Avatar
raamklaza

8 July 2009 at 8:46pm (Last edited: 8 July 2009 8:48pm), Community Member, 182 Posts

Thnx!

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

Just take out all the elements lol :D

Avatar
johnnyN

29 September 2009 at 5:10am Community Member, 2 Posts

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.