3

난 내 레일 projec에 ckeditor를 사용하고 이미지 업로드에 문제가 있습니다.레일 4 ckeditor 파일 업로드

CKEDITOR.editorConfig = (config) -> 
    config.language = 'pl' 
    config.toolbar_Pure = [ 
    '/', 
    { 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' ] }, 
    '/', 
    { name: 'styles',  items: [ 'Styles','Format','Font','FontSize' ] }, 
    { name: 'colors',  items: [ 'TextColor','BGColor' ] }, 
    { name: 'insert',  items: [ 'Image','Table','HorizontalRule','PageBreak' ] }, 
    ] 
    config.toolbar = 'Pure' 
    true 

내보기 :

= f.input :answer, label: false, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Pure'} } 

그리고이 설정에 내가없는 나는 그것을위한 몇 가지 간단한 config.js을 쓴,이 ckeditor 모든 것을 원하지 않는다

= f.input :answer, label: false, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Full'} } 
: 내 config.js 볼 세트를 삭제할 때 enter image description here

그러나 : 버튼이 내 컴퓨터에서 이미지를 선택합니다

그러면 컴퓨터에서 파일을 업로드 할 수있는 버튼이 있으며 모든 것이 잘 작동합니다. 이제는 내 config.js를 편집하여이 파일 업로드 작업을 수행하는 것이 목표입니다. 도와주세요.

답변

7

나는 내 설정을 변경

CKEDITOR.editorConfig = function(config) { 
    config.language = 'pl'; 
    config.filebrowserBrowseUrl = "/ckeditor/attachment_files"; 
    config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files"; 
    config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files"; 
    config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures"; 
    config.filebrowserImageBrowseUrl = "/ckeditor/pictures"; 
    config.filebrowserImageUploadUrl = "/ckeditor/pictures"; 
    config.filebrowserUploadUrl = "/ckeditor/attachment_files"; 
    config.toolbar_Pure = [ 
    '/', { 
     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'] 
    }, '/', { 
     name: 'styles', 
     items: ['Styles', 'Format', 'Font', 'FontSize'] 
    }, { 
     name: 'colors', 
     items: ['TextColor', 'BGColor'] 
    }, { 
     name: 'insert', 
     items: ['Image', 'Table', 'HorizontalRule', 'PageBreak'] 
    } 
    ]; 
    config.toolbar = 'Pure'; 
    return true; 
}; 

을 예상대로 작동