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

Direct edited HTML content being dropped?


Reply

6 Posts   1717 Views

Avatar
logplayer

20 February 2009 at 5:54am Community Member, 3 Posts

I am trying to use the Content Editor and in particular the 'Edit HTML Source' button to input some HTML directly into the content.

However when I enter the HTML and then look at what has been saved - certain sections are missing. An example of a piece of code I am trying to insert is as follows:

<img CLASS="imagelinkpointerout" onmouseover="this.className='imagelinkpointerover'" onmouseout="this.className='imagelinkpointerout'" src="themes/tutorial/images/links/test_logo.gif" width="170" height="106" ALT="Test Logo">

The resultant code is:

<img class="imagelinkpointerout" src="themes/tutorial/images/links/test_logo.gif" border="0" width="170" height="106" ALT="Test Logo">

The onmouseover="this.className='imagelinkpointerover'" and onmouseout="this.className='imagelinkpointerout'" have been dropped for some reason.

I am confused as to why this is happening. Any suggestions on how I can resolve this would be appreciated. :-)

btw - I am running SilverStripe-v2.3.0-rc4

Avatar
Willr

20 February 2009 at 5:39pm Forum Moderator, 5511 Posts

The TinyMCE Configuration strips out things like onmouseout. You will have to edit the config settings in cms/javascript/tinymce.template.js under the 'allowed_elements'

Avatar
Willr

20 February 2009 at 5:39pm Forum Moderator, 5511 Posts

The TinyMCE Configuration strips out things like onmouseout. You will have to edit the config settings in cms/javascript/tinymce.template.js under the 'allowed_elements'

Avatar
logplayer

21 February 2009 at 12:06am (Last edited: 21 February 2009 12:11am), Community Member, 3 Posts

Thanks for the pointer :-)
Having done some additional reading on TinyMCE, I assume by 'allowed_elements' that you mean 'valid_elements'.
However in the cms/javascript/tinymce.template.js file in SilverStripe-v2.3.0-rc4 there is no 'valid_elements' line. I t seems to have been removed since the SilverStripe-v2.2.3 version - I can't (at the moment) find any mention as to why this should be.

Anyway, I followed these recommendations:
[url]http://doc.silverstripe.org/doku.php?id=tinymce&s=tinymce[/url]
[url]http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/extended_valid_elements[/url]

and added these lines:

valid_elements : "*{*}",
extended_valid_elements : "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]"


Note: The '{' & '}' above are open and close square brackets - had to substitute as Code block incorrectly reformats it :-|

Whether the 'extended_valid_elements' line is necessary given that I have selected all elements, I don't know?

However, It still isn't accepting the onmouse over tag :-|

This is becoming frustrating, so any suggestions as to what I am doing wrong would be gratefully received :-)

Avatar
Tomae

7 May 2009 at 12:59am Community Member, 14 Posts

Even i m getting the same problem........... pls help us...........
i desperately need help from somebody ................ if there is no solution then i m in trouble...........

i added this line

valid_elements : "*

  • ",

    but no luck...........

Avatar
banal

7 May 2009 at 5:47am Community Member, 901 Posts

Look here:
http://silverstripe.org/general-questions/show/255947?start=0#post258227