admin管理员组文章数量:1394392
I'm using ckeditor in my rails projec and I have a problem with image uploading. I don't want everything that ckeditor have, that I wrote some simple config.js for it:
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
and in my view:
= f.input :answer, label: false, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Pure'} }
And with this config I don't have a button to select image from my puter:
But when I delete my config.js and in view set:
= f.input :answer, label: false, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Full'} }
then I have the button to upload file from my puter and everything works fine. Now my goal is to edit my config.js to have this file upload working. Please help.
I'm using ckeditor in my rails projec and I have a problem with image uploading. I don't want everything that ckeditor have, that I wrote some simple config.js for it:
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
and in my view:
= f.input :answer, label: false, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Pure'} }
And with this config I don't have a button to select image from my puter:
But when I delete my config.js and in view set:
= f.input :answer, label: false, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Full'} }
then I have the button to upload file from my puter and everything works fine. Now my goal is to edit my config.js to have this file upload working. Please help.
Share Improve this question asked Feb 21, 2014 at 7:47 Mateusz UrbańskiMateusz Urbański 7,90216 gold badges74 silver badges141 bronze badges1 Answer
Reset to default 7I change my config to:
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;
};
and works as expected
本文标签: javascriptRails 4 ckeditor file uploadStack Overflow
版权声明:本文标题:javascript - Rails 4 ckeditor file upload - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744633197a2616666.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论