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.

Content Editor Discussions

Forum for content editors and CMS users.

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

Text aligment, bolt, italic, underline QuickFix / Silverstripe 2.3.2 / TinyMCE


Reply

2 Posts   3367 Views

Avatar
nakashu

12 August 2009 at 10:59am (Last edited: 12 August 2009 3:18pm), Community Member, 24 Posts

From v2.3.2 aligments bolt and italics for texts in tinymce dont work.

fix for alignments:
method-1: --- inside Page.php -- copy following code to getCMSFields() function to.
Credit to: Aram->http://silverstripe.org/content-editor-discussions/show/263801?start=0#post265869

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

Method-2: --- inside cms/code/LeftAndMain.php, line 175, replace line with:

-replace SquareBracket with actual brackets, as it wont show here correctly.

'valid_elements' => "*SquareBracketOpen*SquareBracketClose",

----------------
If you encounter bug regarding not working Bold, Italic and Underline buttons, as i did:
add this inside your themes/YourThemeName/css/typography.css

.typography b,strong{font-weight:bold;}
.typography i,em{font-style:italic;}
.typography u{text-decoration:underline;}

Avatar
benjaminapetersen

20 October 2010 at 3:23am Community Member, 3 Posts

Nice work. I gave it a try though and found it did not fix my issue with underline. The editor puts in the following: < u _moz_dirty="" > underline my text < / u >. (if my code gets stripped out on save, it is a "u" with a class of "_moz_dirty")

I haven't seen "_moz_dirty" before. That's interesting. It seems though that the whole thing is stripped out on save, because when you view on the front end, you only get paragraph tags. I'll do some more digging and see if I can come up with anything.