Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » Customising the blog HTML editor

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 1649 Views
  • Bruce B
    Avatar
    Community Member
    145 Posts

    Customising the blog HTML editor Link to this post

    I have just switched one of my site blogs from BBcode to wysiwyg editing. Unfortunately, this removed the ability to insert links or images into blog entries. The solution is to add a few lines to /blog/_config.php:

    HtmlEditorConfig::get('blog')->insertButtonsBefore('advcode', 'image', 'link', 'unlink', 'separator' );
    HtmlEditorConfig::get('blog')->removeButtons('tablecontrols');
    HtmlEditorConfig::get('blog')->addButtonsToLine(3, 'tablecontrols');

    HtmlEditorConfig::set_active('blog');

    Sources for this idea included:
    SSbits website: http://www.ssbits.com/customising-the-wysywig-editor-in-v2-3-2-tinymce/
    SilverStripe docs: http://doc.silverstripe.org/htmleditorconfig
    The comments in /sapphire/forms/HtmlEditorConfig.php

    Hope this helps somebody. Let me know if is causes problems. I'm using SS 2.4 and blog 0.4

  • wainui
    Avatar
    Community Member
    56 Posts

    Re: Customising the blog HTML editor Link to this post

    cheers bro... just what I was after

  • wainui
    Avatar
    Community Member
    56 Posts

    Re: Customising the blog HTML editor Link to this post

    Just incase anyone ants to activate the media plugin to add dyoutube videos..

    HtmlEditorConfig::get('blog')->enablePlugins('media'); // enables plugin
    HtmlEditorConfig::get('blog')->insertButtonsBefore('advcode', 'media' );

  • Artyom
    Avatar
    Community Member
    22 Posts

    Re: Customising the blog HTML editor Link to this post

    Thanks gents, but the image button is nearly useless, since it only allows one to type in a URL, and not upload an image. wtf? any thoughts?

  • Plato
    Avatar
    Community Member
    26 Posts

    Re: Customising the blog HTML editor Link to this post

    It's the default image button for the editor, is why.
    The one in the CMS is a custom plugin called ss_buttons. But it's specifically designed to work with the CMS...

    Unfortunatly I think you're going to have to hack around the issue to get uploads that land nicely in the assets folder.

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