4

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

  }
}
}
Grant Thomas
  • 44,454
  • 10
  • 85
  • 129
Jimbo
  • 364
  • 1
  • 8
  • 4
    I was able to solve this by adding: `forced_root_block: null` to the `tinyMCE.init()` method Not sure why this would have caused an error in internet explorer though. – Jimbo May 04 '12 at 15:02

1 Answers1

1

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.

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265