2017-02-02 516 views
0

我在我的应用程序中实现了CKEditor。当我试图实例CKEditor到textarea的我在低于CKEditor的CkEditor - 未捕获TypeError:无法读取未定义的属性'getSelection'

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

任何帮助的行得到以下错误

Cannot read property 'getSelection' of undefined 

是非常赞赏。

回答

-3

变化的函数f。$。onload事件里面ckeditor.js到下面

f.$.onload=function(){var toutMs =5000; 
    if(CKEDITOR.document.getHead().$.childElementCount > 6) 
    { 
    toutMs=0; 
     } 
    setTimeout(function(){ 
    A(b,!0) 
    },toutMs) 
    } 
+1

不要。避免这种情况。切勿编辑核心文件。 – Juan

0
  1. 我的文章列表。
  2. 每当我点击任何文章“对话框/模式”应该打开。
  3. 在这样的对话框或模式中,我的文章的内容有一个ckeditor元素。
  4. 当我点击第一个它像一个魅力工作。
  5. 问题是点击第二,第三,第四等

然后我就开始有这个错误之后。

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的实例。容易!现在正在像一个魅力=)

  $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(); 
      } 
     }); 
+0

我花了20分钟写我的上述指示和一个天才把它减去??你应该看到我的脚本工作。我如何报告到stackoverflow?这个?.. –

相关问题