Jump to:

520 Posts in 248 Topics by 263 members

Content Editor Discussions

SilverStripe Forums » Content Editor Discussions » Text aligment, bolt, italic, underline QuickFix / Silverstripe 2.3.2 / TinyMCE

Forum for content editors and CMS users.

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

Page: 1
Go to End
Author Topic: 3320 Views
  • nakashu
    Avatar
    Community Member
    24 Posts

    Text aligment, bolt, italic, underline QuickFix / Silverstripe 2.3.2 / TinyMCE Link to this post

    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;}

  • benjaminapetersen
    Avatar
    Community Member
    3 Posts

    Re: Text aligment, bolt, italic, underline QuickFix / Silverstripe 2.3.2 / TinyMCE Link to this post

    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.

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