Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

In this Discussion

Add Cleditor to other forms in 2.0

vrijvlindervrijvlinder Papillon-Sauvage MVP
edited January 2014 in Tutorials

I managed to add Cleditor editor to all my forms in my forum. That is Activity, Conversations,Messages also.

This is what I did

class cleditorPlugin extends Gdn_Plugin {

    public function PostController_Render_Before($Sender) {

    public function DiscussionController_Render_Before($Sender) {
//adds Cleditor to Activity Form    
         public function ActivityController_Render_Before($Sender) {
//adds Cleditor to Profile Activity Form
 public function ProfileController_Render_Before($Sender) {
//adds Cleditor to the Conversations Form
 public function ConversationsController_Render_Before($Sender) {
//adds Cleditor to the Messages Form
 public function MessagesController_Render_Before($Sender) {
    private function _AddCLEditor($Sender) {
        // Turn off safestyles so the inline styles get applied to comments
        $Config = Gdn::Factory(Gdn::AliasConfig);
        $Config->Set('Garden.Html.SafeStyles', FALSE);

        // Add the CLEditor to the form
        $Options = array('ie' => 'gt IE 6', 'notie' => TRUE); // Exclude IE6
        $Sender->AddJsFile('jquery.cleditor'.(Debug() ? '' : '.min').'.js', 'plugins/cleditor', $Options);
        $Sender->AddCssFile('jquery.cleditor.css', 'plugins/cleditor', $Options);
<style type="text/css">
a.PreviewButton {
    display: none !important;
<script type="text/javascript">
    jQuery(document).ready(function($) {
        // Make sure the removal of autogrow does not break anything
        jQuery.fn.autogrow = function(o) { return; }
        // Attach the editor to comment boxes
        jQuery("#Form_Body.TextBox,#Form_Comment.TextBox").livequery(function() {
            var frm = $(this).parents("div.CommentForm");
            ed = jQuery(this).cleditor({width:"100%", height:"100%"})[0];
            this.editor = ed;
 // Support other plugins!
            jQuery(frm).bind("clearCommentForm", {editor:ed}, function(e) {

    public function Setup(){}



  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    You can also add Cleditor to the Contact plugin message form and I would assume any other message form in other plugins;

    I added the plugin controller to the cleditor

    public function PluginController_Render_Before($Sender) {

    and added #Form_Message to the jquery

    **jQuery("#Form_Body.TextBox,#Form_Comment.TextBox,#Form_Message").livequery(function() {**

Sign In or Register to comment.