ruby-on-rails – 如何在Rails 3.1(gem Asset Pipeline)中配置CKEditor

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 如何在Rails 3.1(gem Asset Pipeline)中配置CKEditor前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经在我的Rails 3.1应用程序上成功地从 https://github.com/galetahub/ckeditor配置了ckeditor gem.我现在的问题是,我不知道如何配置CKEditor.根据自述文件使用的文件根本不存在于启用资产管道的Rails 3.1应用程序中.

解决方法

答案很简单,一旦我弄清了抛出的错误信息.

/应用/资产/ 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' ] }
    ];
}

这是重要的部分,在ckeditor的require之后放置require_tree(包括ckeditor / config.js):
/app/assets/javascript/application.js

//= require jquery
//= require jquery_ujs
//= require ckeditor/ckeditor
//= require_tree .
原文链接:https://www.f2er.com/ruby/266241.html

猜你在找的Ruby相关文章