Javascript Rails 4编辑器文件上载
我在rails项目中使用了ckeditor,我在上传图像时遇到了问题。 我不想要ckeditor拥有的一切,我为此编写了一些简单的config.js:Javascript Rails 4编辑器文件上载,javascript,ruby-on-rails,ruby-on-rails-4,ruby-on-rails-3.2,ckeditor,Javascript,Ruby On Rails,Ruby On Rails 4,Ruby On Rails 3.2,Ckeditor,我在rails项目中使用了ckeditor,我在上传图像时遇到了问题。 我不想要ckeditor拥有的一切,我为此编写了一些简单的config.js: CKEDITOR.editorConfig = (config) -> config.language = 'pl' config.toolbar_Pure = [ '/', { name: 'basicstyles', items: [ 'Bold','Italic','Underline','Strike','S
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;
};
一切如期进行