IE9,IE10中的TinyMCE IndexSizeError

时间:2014-04-07 05:19:00

标签: javascript jquery tinymce

尝试使用以下代码清除并将新内容加载到tinyMce时

tinymce.activeEditor.setContent('')显示错误

IE9, IE10正在显示IndexSizeError

SCRIPT5022: DOM Exception: INDEX_SIZE_ERR (1) 
tinymce.min.js, line 9 character 6620
SCRIPT5022: DOM Exception: INDEX_SIZE_ERR (1) 
tinymce.min.js, line 5 character 19251

我的代码:

$(document).on('change','#MerchantsEmailMarketing_email_promotion_deal_id',function(){

   $("#LoadingImage").show();  

    var dealId=$(this).val();
    var emailBody = tinyMCE.activeEditor.getContent();
    if(dealId =="") {

      if(emailBody.length > 0){

    tinymce.activeEditor.setContent('');

    }

      $("#LoadingImage").hide();  
      return false;
    }
    var data={dealId:dealId}


    if(emailBody.length > 0){

    tinymce.activeEditor.setContent('');

    }

    $.ajax({
          url:'<?php echo Yii::app()->createAbsoluteUrl('admin/loadDealEmailTemplate')?>',
          type:'post',
          dataType:'json',
          data:data,
          success:function(result){


                  tinymce.activeEditor.execCommand('mceInsertContent',true, result.content);

          tinymce.activeEditor.isNotDirty = 1;
           $("#LoadingImage").hide();  
          }
      });

  });

请帮我解决这个问题

1 个答案:

答案 0 :(得分:2)

通过替换tinymce.activeEditor.setContent(&#39;&#39;)解决了这个问题;与

var ed = tinyMCE.activeEditor; 
ed.focus(); 
var txt=""; 
ed.setContent(txt);