简体   繁体   中英

TinyMCE IndexSizeError in IE9,IE10

When trying to clear and load new content to tinyMce using the following code

tinymce.activeEditor.setContent('') its shows an error in

IE9, IE10 is showing 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

My code :

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

  });

please help me to solve this

solved the issue by replacing tinymce.activeEditor.setContent(''); with

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM