2016-08-03 51 views
0

为什么ck编辑器不加载我在源代码模式下所做的最后一项更改? 如果我禁用了ck_editor,那么textarea将显示所有数据。 这是我的代码:ck_editor不加载实际数据

<textarea name="content" id="editor1" rows="10" cols="80"> 
    <?php print $selecteddata['content']; ?> 
</textarea> 

<script> 
     // Replace the <textarea id="editor1"> with a CKEditor 
     // instance, using default configuration. 

     CKEDITOR.replace('content' ,{ 
      filebrowserBrowseUrl : './public/browse.php', 
      filebrowserUploadUrl : '/uploader/index.php', 
      uiColor : '#9AB8F3' 
     }); 

</script> 
+0

还是让我来解释更多,我有一个页面,在这个页面我retrive从数据库中的数据更新数据,所以,然后我就会把它在textarea的如u可以看到上面的代码,然后我试图改变数据源代码模式,并在提交数据库后更新数据,但重新加载此更新页面后,dk ediotr不显示我所做的最后更改。 –

回答

0

试试这个:

<textarea name="content" id="editor1" rows="10" cols="80"> 
     <?php print $selecteddata['content']; ?> 
</textarea> 

<script> 
    $(window).load(function(){ 
     if (typeof(CKEDITOR.instances['content'])=='undefined') { 
      CKEDITOR.replace('content',{ 
      filebrowserBrowseUrl : './public/browse.php', 
      filebrowserUploadUrl : '/uploader/index.php', 
      uiColor : '#9AB8F3' 
     }); 
    } 
    }); 
</script>