CkEditor-未捕获的TypeError:无法读取未定义的属性'getSelection' [英] CkEditor - Uncaught TypeError: Cannot read property 'getSelection' of undefined

查看:645
本文介绍了CkEditor-未捕获的TypeError:无法读取未定义的属性'getSelection'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的应用程序中实现CKEditor.当我尝试实例化CKEditor到textarea时,出现以下错误

I am implementing the CKEditor in my app. When I am trying to instantiate CKEditor to the textarea I am getting following error

Cannot read property 'getSelection' of undefined

在ckeditor的下一行

at below line of ckeditor

getNative: function() {
 return void 0 !== this._.cache.nativeSel ? this._.cache.nativeSel : this._.cache.nativeSel = B ? this.document.$.selection : this.document.getWindow().$.getSelection() }

非常感谢您的帮助.

推荐答案

  1. 我有文章清单.
  2. 每次我点击任何文章,都应该打开对话框/模态".
  3. 在这样的对话框或模式中,我的文章内容包含ckeditor元素.
  4. 当我单击第一个按钮时,它就像一个符咒.
  5. 问题出在第二,第三,第四等之后.

然后我开始出现此错误.

then I started to have this error.

    TypeError: Cannot read property 'getSelection' of undefined
    at CKEDITOR.dom.selection.getNative (ckeditor.js:448)
    at new CKEDITOR.dom.selection (ckeditor.js:446)
    at a.CKEDITOR.editor.getSelection (ckeditor.js:443)
    at new CKEDITOR.plugins.undo.Image (ckeditor.js:1182)
    at CKEDITOR.plugins.undo.UndoManager.save (ckeditor.js:1177)
    at a.<anonymous> (ckeditor.js:1173)
    at a.n (ckeditor.js:10)
    at a.CKEDITOR.event.CKEDITOR.event.fire (ckeditor.js:12)
    at a.CKEDITOR.editor.CKEDITOR.editor.fire (ckeditor.js:13)
    at a.setData (ckeditor.js:275)

对我来说,解决方案很简单,在对话框/模式关闭时告诉计算机销毁ckeditor实例.容易!..现在就像一个魅力=)

the solution for me was easy, tell the computer to destroy the ckeditor instance when the dialog / modal is closed. easy!.. now is working like a charm =)

           $mdDialog.show({
             parent:      parentEl,
             targetEvent: $event,
             templateUrl: '/md-templates/blog-article.html',
             controller:  DialogController,
             scope:         $scope,
             preserveScope: true,
            onRemoving: function (event, removePromise) {
                if (CKEDITOR.instances.body) CKEDITOR.instances.body.destroy();
            }
        });

这篇关于CkEditor-未捕获的TypeError:无法读取未定义的属性'getSelection'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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