Sup*_*erq 3 ruby-on-rails ckeditor
我在我的rails 3应用程序上安装了CKeditor gem.现在我想为它添加一些额外的插件.我查找了ckeditor文档,它说明插件文件需要去ckeditor解压缩的地方.我是rails的新手,我正在尝试找到我的ckeditor文件,但我在app目录中找不到它们,除了我安装ckeditor时创建的模型文件.
我应该在哪里放置我的自定义ckeditor插件的文件,以便在初始化时将它们包含在编辑器中?
编辑: 根据下面的答案添加了上述目录中的插件文件.尝试使用config.js中的以下命令为ckeditor加载插件:
CKEDITOR.editorConfig = function( config )
{
CKEDITOR.plugins.addExternal('insert_blank','http://localhost:3000/assets/ckeditor/plugins/insert_blank/', 'plugin.js');
var temp = CKEDITOR.registered;
alert(temp) ;
config.extraPlugins = 'insert_blank' ;
config.toolbar =
[
{ name: 'basicstyles', items : [ 'Bold','-','Italic' ] },
{ name: 'insert', items : [ 'Image','insert_blank.btn'
] },
];
config.toolbar.push(['insert_blank.btn']);
config.height = 300 ;
config.width = 300 ;
config.removePlugins = 'elementspath,resize' ;
};
Run Code Online (Sandbox Code Playgroud)
这是我的plugin.js文件:
CKEDITOR.plugins.add( 'insert_blank',
{
init: function( editor )
{
editor.addCommand('InsertBlank',
{
exec function(editor)
{
editor.insertHtml( '__');
}
});
editor.ui.addButton( 'insert_blank.btn',
{
label: 'Insert Blank',
command: 'InsertBlank',
icon: this.path + 'images/blank.png'
} );
}
} ) ;
Run Code Online (Sandbox Code Playgroud)
我只是因为我在开发中而给出一条绝对的路径,之后会改变它.上面的警告产生'未定义'.我检查了我的服务器日志,并且应用程序服务器找到了这些文件.看起来我无法正确地将插件添加到ckeditor.关于可能出错的任何想法?
更新:我的plugin.js出现了一些错误.其他一切都很好.
Ale*_*and 10
您可以将所有插件放在应用程序的assets文件夹中.
在app/assets/javascript/ckeditor/plugins此处创建一个文件夹并将所有插件文件放在此处.
| 归档时间: |
|
| 查看次数: |
2582 次 |
| 最近记录: |