小编Sup*_*erq的帖子

使用导轨3中的附加插件修改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', …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails ckeditor

3
推荐指数
1
解决办法
2582
查看次数

Javascript间隔未清除

我有一个相当复杂的页面,有很多ajax调用和后续的dom操作.在一个特定的调用中,它设置一个具有时间限制的间隔(基本上是一个计时器).我已经在clearInterval()任何地方设置,甚至在功能中,但在非常特殊的用例中(它很复杂,我无法确定重现缺陷的确切原因和步骤).

$(function() {
  window.timer_interval; 
  // ...
})
function timer()
{
    var current = 0; 
    time_limit = 60;                                
    window.timer_interval = setInterval(function() {
        minute = ( "0" +  Math.round(Math.floor((time_limit - current)/60))).slice(-2); 
        seconds = ("0" + ((time_limit - current)%60)).slice(-2); 

        $('#timer').html(minute + ":" + seconds);

        if (current >= time_limit) {
            clearInterval(window.timer_interval); 
            window.timer_interval = false; 
        }
        current = current + 1; 
    }, 1000);
}
Run Code Online (Sandbox Code Playgroud)

我已经使用了firbug来检测它的值window.timer_interval,它是false甚至条件都满足.一件事可能是一些图像传输失败(这是可能的应用程序行为,代码写入优雅地降级).我在Mozilla开发.

html javascript browser jquery

0
推荐指数
1
解决办法
2347
查看次数

标签 统计

browser ×1

ckeditor ×1

html ×1

javascript ×1

jquery ×1

ruby-on-rails ×1