TinyMCE IndexSizeError in IE9, IE10

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

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

IE9, IE10shows 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 is:

$(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 solve this problem.

+4
source share
1 answer

solved the problem by replacing tinymce.activeEditor.setContent (''); from

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

Source: https://habr.com/ru/post/1535306/


All Articles