How to configure CKEditor in Rails 3.1 (gem + Asset Pipeline)

后端 未结 5 542
温柔的废话
温柔的废话 2021-01-02 05:31

I\'ve successfully configured the ckeditor gem from https://github.com/galetahub/ckeditor on my Rails 3.1 app. My problem now is that I can\'t figure out how to configure th

5条回答
  •  旧时难觅i
    2021-01-02 06:17

    The answer was easy once i've figured out the thrown error message.

    /app/assets/javascript/ckeditor

    CKEDITOR.editorConfig = function( config )
    {
        config.toolbar_MyToolbar =
        [
            { name: 'document', items : [ 'NewPage','Preview' ] },
            { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
            { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] },
            { name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'
                     ,'Iframe' ] },
                    '/',
            { name: 'styles', items : [ 'Styles','Format' ] },
            { name: 'basicstyles', items : [ 'Bold','Italic','Strike','-','RemoveFormat' ] },
            { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote' ] },
            { name: 'links', items : [ 'Link','Unlink','Anchor' ] },
            { name: 'tools', items : [ 'Maximize','-','About' ] }
        ];
    }
    

    This is the important part, place the require_tree (which includes the ckeditor/config.js) after the require for ckeditor: /app/assets/javascript/application.js

    //= require jquery
    //= require jquery_ujs
    //= require ckeditor/ckeditor
    //= require_tree .
    

提交回复
热议问题