2013-06-21 4 views
5

CKEditor gem (https://github.com/galetahub/ckeditor)과 함께 CKEditor를 사용하고 있으며 사용자 지정 도구 모음을 추가 할 때까지 모든 것이 올바르게 작동합니다.레일의 CKEditor에 사용자 지정 도구 모음 추가

내가 본 일부 게시물은 config.js 파일 사용을 제안합니다. 그러나 지침에 따라 설정하면 app/assets/javascripts/ckeditor/config.js 파일이 없습니다. 또한 /ckeditor/config.js을 javascript 디렉토리에 추가하면 파일 업로드 기능이 작동하지 않습니다. config.js이 빈 파일 인 경우에도 이런 문제가 발생합니다. '업로드'탭은 서버를 재부팅 할 때 숨겨져 작동하지 않게됩니다.

도구 모음을 보편적으로 사용자 정의 할 수있는 방법이 있습니까? 난 그냥 레일 3.2.11 내 Gemfile에

을 사용하여 도움이 될 것입니다 뭔가 ...

인라인 옵션을 쌍 또는 수없는 경우에도 아니면 내가 가지고

gem "jquery-rails", "~> 2.2.1" 
gem "ckeditor" 
gem "carrierwave" 
gem "mini_magick" 
gem "cloudinary" 

에서 application.rb 내가 가진 : 응용 프로그램에서

config.autoload_paths += %W(#{config.root}/app/models/ckeditor) 

합니다. JS 내가 가진 : 내 양식에

//= require jquery 
//= require jquery_ujs 
//= require bootstrap 
//= require ckeditor/init 
//= require_tree ../../../vendor/assets/javascripts/. 
//= require_tree . 

내가 가진 :

CKEDITOR.editorConfig = function(config) { 
    config.toolbar_Custom = [ 
    { name: 'document', items : [ 'Source','-','Save','NewPage','DocProps','Preview','-','Templates' ] }, 
    { name: 'clipboard', items : [ 'PasteFromWord','-','Undo','Redo' ] }, 
    { name: 'insert',  items : [ 'Image','Table','HorizontalRule','SpecialChar','PageBreak' ] }, 
    { name: 'tools',  items : [ 'Maximize', 'ShowBlocks','-','About' ] }, 
    '/', 
    { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, 
    { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] }, 
    { name: 'links',  items : [ 'Link','Unlink','Anchor' ] }, 
    '/', 
    { name: 'styles',  items : [ 'Styles','Format','Font','FontSize' ] }, 
    { name: 'colors',  items : [ 'TextColor','BGColor' ] } 
    ]; 

    config.toolbar = 'Custom'; 
}; 

답변

1

을 당신은 당신을 만들어야합니다 :

= f.cktext_area :content 

config.js 내가 사용하려고 파일 자체 config.js 파일을 수동으로 설치하십시오. 업로드 탭을 유지하려면, 그것을 해결하는 방법에 대해 설명합니다 ckeditor 보석의 repo에이 문제를 따르

https://github.com/galetahub/ckeditor/issues/238

그냥 참조 설정을 붙여 귀하의 config.js 파일로 filebrowser 및 업로드 탭을위한 자바 스크립트 모든 기능을 갖춘 상태로 돌아올 것입니다.

관련 문제