Jimbo
Jimbo

Reputation: 364

How do I resolve the "Object required" error message with TinyMCE and Internet Explorer 8

I am using TinyMCE 3.5 with the jQuery Plugin.

I am using the tinyMCE.init() method with no mode specified and then attaching the editor to my elements with:

tinyMCE.execCommand('mceToggleEditor',false,jQuery(this).attr('id'));

The editor loads successfuly in internet explorer 8 but throws the "Object required" error

The error is thrown from ForceBlocks.js on line 22 which is as follows:

21 while (node != rootNode) {
22   if (blockElements[node.nodeName])
23     return;
24 
25   node = node.parentNode;
26 }

No error is throw in firefox, chrome or safari.

The context of the tinyMCE.execCommand method is:

ADMIN = {
  triggerTextArea: function (event) {

    currentTarget = event.currentTarget;

    if(jQuery(currentTarget).hasClass('ajaxform'))
    {
      textareas = jQuery(this).find('.question-text-editor textarea');
      addTextArea = true;
    } else {
      textareas = jQuery(this).closest('.question-wrapper').find('.question-text-editor textarea');    
      addTextArea = (jQuery(this).is(':checked') && jQuery(this).val() == 'html');
    }


    if(addTextArea == true)
    {
      textareas.each(function() {
          console.log(jQuery(this).attr('id'));
          tinyMCE.execCommand('mceToggleEditor',false,jQuery(this).attr('id'));

        });



    } else {
      textareas.each(function() {
        editorId = jQuery(this).attr('id');
        tinymce.get(editorId).hide(); 
      });

    }
  }
}

  if(addTextArea == true)
  {
    textareas.each(function() {
        console.log(jQuery(this).attr('id'));
        tinyMCE.execCommand('mceToggleEditor',false,jQuery(this).attr('id'));

      });



  } else {
    textareas.each(function() {
      editorId = jQuery(this).attr('id');
      tinymce.get(editorId).hide(); 
    });

  }
}
}

Upvotes: 4

Views: 920

Answers (1)

Paul Sweatte
Paul Sweatte

Reputation: 24617

forced_root_block is covered in a related question. For IE it is necessary to poll the document if the editor is not immediately available after the execCommand load event.

Upvotes: 1

Related Questions