How to configure default options of "ckeditor_rails" gem

52 views
Skip to first unread message

Rasool SB

unread,
Aug 31, 2014, 2:22:26 PM8/31/14
to rubyonra...@googlegroups.com

I am new to Rails., can you please guide me to how to edit the default options of "ckeditor_rails" like normal ckeditor do. Please help me.! Thanks in Advance.


Damjan Rems

unread,
Sep 1, 2014, 4:01:13 AM9/1/14
to rubyonra...@googlegroups.com
New to Rails and you started probably with the hardest cracker by my
opinion ;-)

CK loads setting dynamical when it is loaded into browser. Which can not
be done right with assets pipeline.

If you read documentation on github you will see this:
----------
Customize ckeditor


In order to configure the ckeditor default options, create files:

app/assets/javascripts/ckeditor/config.js

app/assets/javascripts/ckeditor/contents.css
----------

It should probably work. I don't use this gem.

I kinda made CK work by myself and I put config files directly to public
folder (I can have multiple configs for multiple sites). Location of
configuration files can be set in javascript when object is initialized.

by
TheR

--
Posted via http://www.ruby-forum.com/.

Rasool SB

unread,
Sep 1, 2014, 12:06:09 PM9/1/14
to rubyonra...@googlegroups.com
Hi Damjan Rems,

    Thank you so much for your reply, Oops, is that a cracker..?!, (OMG), Yes I followed the gems documentation and have created files according through the documentation, 
    but, they did not mention any options about how to remove buttons(options) which are not necessary for my app. like "source, save, new page, print, paste text, paste from' etc.,
   And I also included the scripting code 
       $('.ckeditor').ckeditor({
  // optional config 
        })
    in java file "app/assets/javascripts/application.js", I did not understand what to replace in the place of "// optional config " 

Thank you,

Rasool SB

unread,
Sep 1, 2014, 1:10:48 PM9/1/14
to rubyonra...@googlegroups.com
Or., Is there any other gem.. like ckeditor..?? Please help me..!!

Damjan Rems

unread,
Sep 2, 2014, 6:48:38 AM9/2/14
to rubyonra...@googlegroups.com
My solution is specific to CMS I am building. My biggest cracker at the
moment is documentation ;-)

It took me about two days to crack toolbar. Although everything is in ck
documentation http://docs.ckeditor.com it is very muddy ;-(

Put this somewhere into ck_config.js

CKEDITOR.editorConfig = function( config ) {
config.toolbar_basic = [
[ 'Save', '-', 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord',
'-', 'Undo', 'Redo' ],
[ 'Bold', 'Italic', 'Underline',
'-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock']
];
//You may reconfigure toolbar for all sessions
config.toolbar = config.toolbar_basic;
};

Or comment out last line and put into ckeditor object initializer for
specific session:

CKEDITOR.replace( 'record_body',{height: 500, customConfig:
'/ck/ck_config.js', contentsCss: '/ck/ck_css.css', toolbar: 'basic'} )

Rasool SB

unread,
Sep 2, 2014, 12:13:21 PM9/2/14
to rubyonra...@googlegroups.com
Hi Damjan Rems,

    Thank you so so so so much, you did a fantastic job, solved my problem, was waiting for this solution.

Thanks & Regards,
Rasool.

Rasool SB

unread,
Sep 6, 2014, 8:34:17 AM9/6/14
to rubyonra...@googlegroups.com
Hi Damjan Rems,
 
     Thank you so much for sharing your effort, it works superb. :)

Regards,
Reply all
Reply to author
Forward
0 new messages