[英]Rails 4 ckeditor file upload
我在我的rails項目中使用了ckeditor,我的圖像上傳有問題。 我不想要ckeditor所擁有的一切,我為它寫了一些簡單的config.js:
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並在視圖集中時:
= f.input :answer, label: false, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Full'} }
然后我有從我的電腦上傳文件的按鈕,一切正常。 現在我的目標是編輯我的config.js以使此文件上傳工作。 請幫忙。
我將配置更改為:
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;
};
並按預期工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.