1

我在我的模态(材料设计模板)中加载 CKEditor 时遇到问题。它适用于模态的第一次加载。
但是,当我通过 ajax 调用打开模式而不重新加载(刷新)页面时,CKeditor 无法将文本提供给 textarea。
当 CKEditor 在控制台中加载时出错,说明
TypeError: $(...).get(...) is undefined ” in Firefox
Uncaught TypeError: Cannot read property 'contentWindow' of undefined ” 在 Chrome
我的 jquery 方法如下我呼吁每个模式打开。

    //being callled in ajax success and modal open
var description = CKEDITOR.replace( 'description' );
loadEditorData();


// Function to get and Load Editor's contents.
function loadEditorData() {
 setTimeout(function(){
         $( $("#cke_1_contents iframe" ).get(0).contentWindow.document ).keypress( function() {
             setTimeout(function(){
              var editorText = CKEDITOR.instances.description.getData();
              console.log(editorText);
              $("#description").html(editorText);
              }, 10);
            });
     }, 5000);
 }
4

0 回答 0