includes/clientside/static/dynano.js
changeset 474 3d751a6f2b05
parent 413 6607cd646d6d
child 493 d8296f89ebb5
--- a/includes/clientside/static/dynano.js	Sun Mar 02 22:52:23 2008 -0500
+++ b/includes/clientside/static/dynano.js	Wed Mar 05 23:10:26 2008 -0500
@@ -89,21 +89,30 @@
 
 function DN_switchToMCE(performWikiTransform)
 {
-  //if ( this.object.dn_is_mce )
-  //  return this;
   if ( !this.object.id )
     this.object.id = 'textarea_' + Math.floor(Math.random() * 1000000);
   if ( !this.object.name )
     this.object.name = 'textarea_' + Math.floor(Math.random() * 1000000);
-  // TinyMCE 2.x
-  // tinyMCE.addMCEControl(this.object, this.object.name, document);
-  // TinyMCE 3.x
+  // Updated for TinyMCE 3.x
   if ( performWikiTransform )
   {
     this.object.value = DN_WikitextToXHTML(this.object.value);
   }
-  tinyMCE.execCommand("mceAddControl", true, this.object.id);
-  this.object.dnIsMCE = 'yes';
+  // If tinyMCE init hasn't been called yet, do it now.
+  if ( !tinymce_initted )
+  {
+    enano_tinymce_options.mode = 'exact';
+    enano_tinymce_options.elements = this.object.name;
+    console.debug(enano_tinymce_options);
+    initTinyMCE();
+    this.object.dnIsMCE = 'yes';
+    return true;
+  }
+  else
+  {
+    tinyMCE.execCommand("mceAddControl", true, this.object.id);
+    this.object.dnIsMCE = 'yes';
+  }
   return this;
 }