2017-02-02 505 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?這個?.. –

相關問題