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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Script doesn't stay in editor


Go to End


7 Posts   2296 Views

Avatar
raamklaza

Community Member, 182 Posts

7 July 2009 at 7:43am

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

Community Member, 607 Posts

7 July 2009 at 12:34pm

Edited: 07/07/2009 12:34pm

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

Community Member, 182 Posts

7 July 2009 at 9:28pm

Yes that could be it.

How can i solve this easily?

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

Avatar
TotalNet

Community Member, 181 Posts

8 July 2009 at 2:12pm

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

Community Member, 607 Posts

8 July 2009 at 2:27pm

Edited: 08/07/2009 2:28pm

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

Community Member, 182 Posts

8 July 2009 at 8:46pm

Edited: 08/07/2009 8:48pm

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

Community Member, 2 Posts

29 September 2009 at 5:10am

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.