Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set ckeditor config when using the jquery version?

I'm using the jquery version of ckeditor, like this:

$(".textarea").ckeditor();

I need to specify the toolbar buttons, but I don't know how. All the help I found here on stackoverflow or using google was for the old javascript ckeditor version, OR I don't know how to use it with jquery (code above).

Also, how do I specify the css file location, so that the ckeditor loads my css and displays the data the same way it will be displayed on the site?

Anyone can help with this mess?

like image 312
Frantisek Avatar asked Jun 09 '26 10:06

Frantisek


2 Answers

$(".textarea").ckeditor(function() { 
   // Instance loaded callback.
}, {
   // Config here.
});
like image 151
alex Avatar answered Jun 11 '26 23:06

alex


Not sure if this is a new feature of CKEDITOR, but just want to share my solution (in case it helps anyone looking for this now):

$("textarea.youreditor").ckeditor
(
    {
        customConfig: "/path/to/custom/config.js"
    }
);

... and my config looks like this (simply copied the default config.js:

CKEDITOR.editorConfig = function(config)
{
    config.toolbar_Full =
    [
        { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
        { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'] },
        { name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ] },
        { name: 'colors', items : [ 'TextColor','BGColor' ] }
    ];  
};    

** I am cross posting my solution from here: How do I pass in config info to CKEditor using the jQuery adapter?

like image 20
nokturnal Avatar answered Jun 11 '26 23:06

nokturnal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!