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.

Content Editor Discussions /

Forum for content editors and CMS users.

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

span styling disabled in silverstripe ver 2.3.2


Go to End


11 Posts   7143 Views

Avatar
Tomae

Community Member, 14 Posts

2 July 2009 at 5:30pm

Edited: 02/07/2009 6:06pm

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

Avatar
BuddhaSource

Community Member, 57 Posts

2 July 2009 at 6:17pm

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

Avatar
Design City

38 Posts

2 July 2009 at 6:34pm

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 :)

Avatar
BuddhaSource

Community Member, 57 Posts

2 July 2009 at 6:58pm

@DesignCity

Thanks.

It worked.

Avatar
HenryE

Community Member, 6 Posts

24 July 2009 at 9:03pm

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.

Avatar
Design City

38 Posts

24 July 2009 at 9:17pm

Edited: 24/07/2009 9:19pm

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 :)

Avatar
Carbon Crayon

Community Member, 598 Posts

2 August 2009 at 3:19am

Edited: 02/08/2009 3:22am

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]');

Avatar
HenryE

Community Member, 6 Posts

2 August 2009 at 10:32am

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)

Go to Top