Jump to:

23013 Posts in 11540 Topics by 2825 members

General Questions

SilverStripe Forums » General Questions » Direct edited HTML content being dropped?

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: 1621 Views
  • logplayer
    Avatar
    Community Member
    3 Posts

    Direct edited HTML content being dropped? Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Direct edited HTML content being dropped? Link to this post

    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'

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Direct edited HTML content being dropped? Link to this post

    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'

  • logplayer
    Avatar
    Community Member
    3 Posts

    Re: Direct edited HTML content being dropped? Link to this post

    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:
    http://doc.silverstripe.org/doku.php?id=tinymce&s=tinymce
    http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/extended_valid_elements

    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

  • Tomae
    Avatar
    Community Member
    14 Posts

    Re: Direct edited HTML content being dropped? Link to this post

    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...........

  • banal
    Avatar
    Community Member
    901 Posts
    1621 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.