Jump to:

521 Posts in 248 Topics by 263 members

Content Editor Discussions

SilverStripe Forums » Content Editor Discussions » span styling disabled in silverstripe ver 2.3.2

Forum for content editors and CMS users.

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

Page: 1 2
Go to End
Author Topic: 3709 Views
  • Tomae
    Avatar
    Community Member
    14 Posts

    span styling disabled in silverstripe ver 2.3.2 Link to this post

    Silverstripe drops out css styling for span......... i just upadated my silverstripe to version 2.3.2 ......... in earlier version it ws working properly........... all styling which i had given to spans through content editor is gone now......... it happens when i re-edit the content with new version of silverstripe......

    in many places i had given styling for spans....... if editor drops out my styling, then i wont be able to re-edit my contents.......

    Tomae

  • BuddhaSource
    Avatar
    Community Member
    57 Posts

    Re: span styling disabled in silverstripe ver 2.3.2 Link to this post

    @Tomae

    Yes I have realized the same. In ver 2.3.2 inline Styling has been disabled for SPAN where as it still works for DIV .

    eg :

    <span style="color:#fff" > Hello World </span>

    ^^ Styling is removed from Tinymce when I click on insert.

    If this was intentionally done please requesting to disable it or a way out.
    Otherwise we end up using too many classes.

  • DesignCity
    Avatar
    38 Posts

    Re: span styling disabled in silverstripe ver 2.3.2 Link to this post

    Gents,

    This is done by TinyMCE, not Siverstripe per se. Tiny was upgraded for SS 2.3.x, and with it a new set of default rules.

    Check out CMS/code/LeftAndMain.php, around line 175 ('valid_elements'). This sets the tags and corresponding attributes that TinyMCE will allow in the content editor. You should be able to add style to the span tag and enable it.

    For more information check out the TinyMCE wiki here --> http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements

    Please keep in mind that style tags aren't great form and classes should be used to style elements where ever possible.

    HTH

  • BuddhaSource
    Avatar
    Community Member
    57 Posts

    Re: span styling disabled in silverstripe ver 2.3.2 Link to this post

    @DesignCity

    Thanks.

    It worked.

  • HenryE
    Avatar
    Community Member
    6 Posts

    Re: span styling disabled in silverstripe ver 2.3.2 Link to this post

    Thanks heaps for the info provided (DesignCity), I found it very useful.

    My single greatest gripe about Silverstripe is the ability to work with raw HTML. I wish all the information regarding this was easier to find. I'm not a programmer type, more of a designer, but I want to easily be able to add html for things like swfobject (to make flash validate) etc.

    In one method I tried editing line 158 (cms/code/LeftAndMain.php) to replace with:

    HtmlEditorConfig::get('cms')->setOptions(array('entity_encoding'=>'raw'));

    - I might not have done this correctly, but it worked in that I could use completely raw html... But then in the cms it wouldn't save and publish my pages properly (it would hang and I would have to flush constantly to open different pages etc). I currently use iframes to include my flash content, and I'm sure there must be a better way out there... (I'm using Silverstripe 2.3.2)

    I still have yet to uncover the best way to enable the cms to work with completely raw html including javascript etc without it being stripped out.. If anyone out there has ideas, please keep me posted.

  • DesignCity
    Avatar
    38 Posts

    Re: span styling disabled in silverstripe ver 2.3.2 Link to this post

    Hi HenryE,

    Please keep in mind that Silverstripe uses TinyMCE - everything to do with what happens in that content box is basically Tiny. You'd probably do well to search/post on the Tiny forums for answers to specific questions like that.

    Having said that, I think the link I provided in this post (http://www.silverstripe.org/content-editor-discussions/show/263801?start=0#post263804) has the answer:

    Use *[ * ] to include all elements and all attributes. This can be very useful when used with the invalid_elements option.

    (I added the spaces inside the square brackets because otherwise the forums thinks it's BBcode - don't include the spaces in your LeftAndMain.php!)

    Replace everything in the valid elements array with just this - *[ * ]

    Haven't tested it myself, but it should work just fine

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: span styling disabled in silverstripe ver 2.3.2 Link to this post

    Hi Guys

    I just noticed and fixed this in a site I am working on, then found this thread. It seems like a rediculous decision to have removed the style attribute as it means that half the buttons on the top row of the toolbar now don't work, for example the text alignement on paragraphs wont work, nor will underline or italic. If the idea is to encourage using classes then remove the buttons that no longer work, rather than confusing people.

    Anyway rant over, I just stuck this (very long) line in my Page.php getCMSFields() function to fix it (no need to edit LeftAndMain.php):

          HtmlEditorConfig::get('cms')->setOption('valid_elements', '+a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class|style],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align|style],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],-td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align],address[class|align],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],dd[id|class|title|dir],dl[id|class|title|dir]
    ,dt[id|class|title|dir]');

  • HenryE
    Avatar
    Community Member
    6 Posts

    Re: span styling disabled in silverstripe ver 2.3.2 Link to this post

    Hi DesignCity & Aram,

    As a SS novice I just wanted to thank you both for the input, I really appreciate it. Aram, curiously I've never used the buttons you mentioned (I always use the html editor), however I probably should use the buttons, so it is good to know about the problem, and thanks for the alternative.

    If you have any specific advise, or know of any methods regarding embedding Flash using SWFObject, please keep me posted. Otherwise I'm assuming the options you have both provided may allow for this? - I will most likely post again here if I have any trouble.

    H. (www.henryegloff.com.au)

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