CKEditor的新实例总是卸载 [英] CKEditor New Instance always unloaded

查看:590
本文介绍了CKEditor的新实例总是卸载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用我的角度应用程序的CKEditor并重新加载我CKEditor的情况下,每次用户访问一个新的模型的视图。

I'm using CKEditor in my Angular app and have a view that reloads my CKEditor instance every time users access a new model.

我用下面的JS初始化编辑:

I'm using the following JS to initialize the editor:

var initEditor = function() {
  $('.js-editor-wrap').html("<textarea id='editor'></textarea>");

  var editor = CKEDITOR.replace('editor', {});

  editor.on('loaded', function() {
    console.log('editor loaded');
  });

  editor.on('instanceReady', function() {
    console.log('instance ready')
  });
}

和以下摧毁编辑:

var destroyEditor = function() {
  if (CKEDITOR.instances['editor']) {
    CKEDITOR.instances['editor'].destroy(true);
    $('#editor').off().remove();
  }
}

第一个编辑器的初始化工作,正如预期,但随后的初始化创建一个编辑器实例的卸载状态,永远不会触发装或instanceReady事件。我没有看到在控制台中的任何错误。

The first editor initialization works just as expected, but subsequent initializations create an editor instance with a status of "unloaded" that never triggers the "loaded" or "instanceReady" events. I'm not seeing any errors in the console.

任何想法可能会导致什么呢?

Any ideas what might be causing this?

这绝对是一个类似的问题,以下内容,但足够不同的,我认为它保证其自身的问题:的 CKEditor的实例已经存在

This is definitely a similar issue to the following, but different enough that I think it warrants its own question: CKEditor instance already exists

推荐答案

在很多更多的挖掘,并感谢来自JEY Dwork的的jsfiddle,我想通了其中的问题就在这里。我CKEditor的配置文件中添加了一对夫妇的引用了被命名不当郎文件的插件。出于某种原因,当这些插件被列入他们一起引起了编辑器没有第二个初始化过程中完全加载。

After a LOT more digging and thanks to the jsfiddle from Jey Dwork, I figured out where the issue is here. My CKEditor config file adds a couple of plugins that referenced lang files that were improperly named. For some reason, when these plugins were included together they caused the editor to not fully load during a second initialization.

删除郎文件和参​​考他们在插件定义的解决了这个问题。这太糟糕了,有没有一些错误是围绕这个触发。所有的好就一切都好,虽然。

Removing the lang files and reference to them in the plugin definitions resolved the issue. It's too bad that there wasn't some error that was triggered around this. All's well that ends well though.

这篇关于CKEditor的新实例总是卸载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆