【问题标题】:Ember.js and CKEDITOR conflict: Cannot read property 'type' of undefinedEmber.js 和 CKEDITOR 冲突:无法读取未定义的属性“类型”
【发布时间】:2013-04-18 15:19:02
【问题描述】:

Ember.JS 和 CKEDITOR 之间存在冲突。如果我使用的是 Ember.js,工具栏(模式窗口)将不起作用。如果我尝试推动例如粘贴按钮,然后我收到以下错误消息,窗口变白,没有模式窗口。

Uncaught TypeError: Cannot read property 'type' of undefined

如果我删除 Ember.Js,那么 CKeditor 可以正常工作。

在 jsfiddle 上查看该问题的现场演示 http://jsfiddle.net/HEhMq/13/

这就是我将 CKEDITOR 嵌入到我的 ember 模板的方式:

App.HTMLTextArea = Ember.TextArea.extend({
    didInsertElement: function() {
        this._super();
        var self = this;
        var elementId = self.get('elementId');

        var edit = CKEDITOR.replace( elementId, {
            extraPlugins : 'autogrow',
            autoGrow_maxHeight : 800,
            // Remove the Resize plugin as it does not make sense to use it in conjunction with the AutoGrow plugin.
            removePlugins : 'resize'
        });

        edit.on('blur', function(e) {
                if (e.editor.checkDirty()) {
                        self.set('value', edit.getData() );
                }
        });
    }
});

使用此代码,编辑器可以正常加载并更新 Ember 值。只是工具栏按钮不起作用。

有人遇到过同样的问题吗?

【问题讨论】:

  • 您附加的 jsfiddle 显示了普通编辑器 - 没有错误,也没有 Ember 代码。你能检查一下吗?
  • 错误是当您尝试按下工具栏上的按钮以打开模式窗口时。 ember.js 包含在内,不需要实际的 ember 代码。关键是因为 Ember 存在冲突,并且那些工具栏按钮不起作用。如果您从资源中删除 ember,则按钮可以正常工作
  • 你能举一个使用ckeditor的ember例子吗?我似乎无法让它工作。

标签: ember.js ckeditor wysiwyg


【解决方案1】:

幸运的是,事实证明我们已经修复了这个问题:http://dev.ckeditor.com/ticket/10265 几天前我们就这样做了,计划于下周发布的新版本 (4.1.1) 将包含此补丁。事实上,CKEditor repo 上的 master 已经被冻结了,所以你可以使用它,因为它不太可能发生变化。

【讨论】:

  • 感谢 Reinmar 的信息!它现在正在使用 CKEditor 版本 4.1.1 :)
猜你喜欢
  • 1970-01-01
  • 2014-08-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-20
  • 2021-11-30
  • 2019-06-03
  • 2017-02-08
相关资源
最近更新 更多