includes/clientside/static/dynano.js
changeset 474 3d751a6f2b05
parent 413 6607cd646d6d
child 493 d8296f89ebb5
equal deleted inserted replaced
473:518bc2b214f1 474:3d751a6f2b05
    87   return left_offset;
    87   return left_offset;
    88 }
    88 }
    89 
    89 
    90 function DN_switchToMCE(performWikiTransform)
    90 function DN_switchToMCE(performWikiTransform)
    91 {
    91 {
    92   //if ( this.object.dn_is_mce )
       
    93   //  return this;
       
    94   if ( !this.object.id )
    92   if ( !this.object.id )
    95     this.object.id = 'textarea_' + Math.floor(Math.random() * 1000000);
    93     this.object.id = 'textarea_' + Math.floor(Math.random() * 1000000);
    96   if ( !this.object.name )
    94   if ( !this.object.name )
    97     this.object.name = 'textarea_' + Math.floor(Math.random() * 1000000);
    95     this.object.name = 'textarea_' + Math.floor(Math.random() * 1000000);
    98   // TinyMCE 2.x
    96   // Updated for TinyMCE 3.x
    99   // tinyMCE.addMCEControl(this.object, this.object.name, document);
       
   100   // TinyMCE 3.x
       
   101   if ( performWikiTransform )
    97   if ( performWikiTransform )
   102   {
    98   {
   103     this.object.value = DN_WikitextToXHTML(this.object.value);
    99     this.object.value = DN_WikitextToXHTML(this.object.value);
   104   }
   100   }
   105   tinyMCE.execCommand("mceAddControl", true, this.object.id);
   101   // If tinyMCE init hasn't been called yet, do it now.
   106   this.object.dnIsMCE = 'yes';
   102   if ( !tinymce_initted )
       
   103   {
       
   104     enano_tinymce_options.mode = 'exact';
       
   105     enano_tinymce_options.elements = this.object.name;
       
   106     console.debug(enano_tinymce_options);
       
   107     initTinyMCE();
       
   108     this.object.dnIsMCE = 'yes';
       
   109     return true;
       
   110   }
       
   111   else
       
   112   {
       
   113     tinyMCE.execCommand("mceAddControl", true, this.object.id);
       
   114     this.object.dnIsMCE = 'yes';
       
   115   }
   107   return this;
   116   return this;
   108 }
   117 }
   109 
   118 
   110 function DN_destroyMCE(performWikiTransform)
   119 function DN_destroyMCE(performWikiTransform)
   111 {
   120 {