TinyMCE won't load and breaks other JS

callidusictus - June 23, 2008 - 23:19
Project:TinyMCE
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

I have drupal 6.2 and I have tried both the 6.x-1.1-dev and 6.x-1.x-dev module. I tried both 2.1, 3.0.9 and 3.1 of the core tinyMCE. In all cases, I have created a profile, assigned a role and made sure the permissions are set. When enabled, the editor does not load and the js to expland the create content options breaks. I cannot access the posting options nor resize the length of the text field. I have tried the default garland theme and wabi. This is the case for IE7 and FF3. I have posted the code from the header below.

<script type="text/javascript" src="/sites/default/files/js/71bee15a87d2b6c81d852cf38f98232d.js"></script>

<script type="text/javascript">jQuery.extend(Drupal.settings, { "basePath": "/", "ahah": { "edit-attach": { "url": "/upload/js", "event": "mousedown", "keypress": true, "wrapper": "attach-wrapper", "selector": "#edit-attach", "effect": "none", "method": "replace", "progress": { "type": "bar", "message": "Please wait..." }, "button": { "attach": "Attach" } } }, "tableDrag": { "upload-attachments": { "upload-weight": [ { "target": "upload-weight", "source": "upload-weight", "relationship": "sibling", "action": "order", "hidden": true, "limit": 0 } ] } } });</script>
<script type="text/javascript">
  function mceToggle(id, linkid) {
    element = document.getElementById(id);
    link = document.getElementById(linkid);
    img_assist = document.getElementById('img_assist-link-'+ id);

    if (tinyMCE.getEditorId(element.id) == null) {
      tinyMCE.addMCEControl(element, element.id);
      element.togg = 'on';
      link.innerHTML = 'disable rich-text';
      link.href = "javascript:mceToggle('" +id+ "', '" +linkid+ "');";
      if (img_assist)
        img_assist.innerHTML = '';
      link.blur();
    }
    else {
      tinyMCE.removeMCEControl(tinyMCE.getEditorId(element.id));
      element.togg = 'off';
      link.innerHTML = 'enable rich-text';
      link.href = "javascript:mceToggle('" +id+ "', '" +linkid+ "');";
      if (img_assist)
        img_assist.innerHTML = img_assist_default_link;
      link.blur();
    }
  }
</script>
<script type="text/javascript">
  tinyMCE.init({
    mode : "exact",
    theme : "advanced",
    relative_urls : false,
    document_base_url : "/",
    language : "en",
    safari_warning : false,
    entity_encoding : "raw",
    verify_html : false,
    preformatted : false,
    convert_fonts_to_spans : true,
    remove_linebreaks : true,
    apply_source_formatting : true,
    theme_advanced_resize_horizontal : false,
    theme_advanced_resizing_use_cookie : false,
    plugins : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_path_location : "bottom",
    theme_advanced_resizing : true,
    theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6",
    content_css : "/themes/wabi/style.css",
    elements : "edit-body"
  });
</script>
    <!--[if lt IE 7]>
    <style type="text/css" media="all">@import "/themes/wabi/fix-ie.css";</style>
    <![endif]-->
  <script type="text/javascript"></script>

#1

loze - July 5, 2008 - 02:40

I have the same issue.

I think this is due to drupals js compression being on, when its off, it works fine.

does anyone know how to use tinymce with drupals js compression?

thanks.

#2

loze - July 12, 2008 - 20:56

Im asking this again because it seems someone out there has had to of addressed this. I just cannot find info on this anywhere.

Using drupal 6, when js compression is turned on (/admin/settings/performance "optimize JavaScript"), TinyMCE's js breaks

does anyone know how to avoid this?
-thanks

#3

Magnity - August 23, 2008 - 22:27
Category:support request» bug report

I have also found this issue - to me its a bug report rather than support request. I've solved by turning off js optimisation.

#4

gsivorot - September 3, 2008 - 23:23

Temporary fix:

Turn off preprocessing for the tiny_mce js file in the Tiny MCE module:

Change this...
drupal_add_js($tinymce_mod_path .'/tinymce/jscripts/tiny_mce/tiny_mce.js');

To this...
drupal_add_js($tinymce_mod_path .'/tinymce/jscripts/tiny_mce/tiny_mce.js', 'module', 'header', FALSE, TRUE, FALSE);

At least the other js files will be optimized.

#5

mcarrera - November 7, 2008 - 20:54

That works great. Thanks!

#6

Jaza - May 8, 2009 - 01:46

#4 works great for me too. I've ported this fix over to the WYSIWYG issue queue as a patch: http://drupal.org/node/456998

 
 

Drupal is a registered trademark of Dries Buytaert.