win*_*ons 10 ruby-on-rails ckeditor asset-pipeline
我已经在我的Rails 3.1应用程序上成功配置了https://github.com/galetahub/ckeditor的ckeditor gem .我现在的问题是我无法弄清楚如何配置CKEditor.在启用了资产管道的Rails 3.1应用程序中,根据自述文件使用的文件根本不存在.
win*_*ons 22
一旦我弄清楚抛出的错误信息,答案很简单.
/应用/资产/ 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' ] }
];
}
Run Code Online (Sandbox Code Playgroud)
这是重要的部分,在ckeditor 的需求之后放置require_tree(包括ckeditor/config.js): /app/assets/javascript/application.js
//= require jquery
//= require jquery_ujs
//= require ckeditor/ckeditor
//= require_tree .
Run Code Online (Sandbox Code Playgroud)
所以我昨天通过省略CKEDITOR.editorConfig = function(config){}部分来使用Rails 4.0 rc1和Ruby 2.0.
我在app/assets/javascripts/ckedtior/config.js中的最终代码是
CKEDITOR.config.toolbar= [
{ name: 'basicstyles', items: [ 'Bold', 'Italic' ] }
]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10448 次 |
| 最近记录: |