includes/clientside/static/editor.js
changeset 419 b8b4e38825db
parent 417 b76ebe229548
child 420 301f546688d1
--- a/includes/clientside/static/editor.js	Tue Feb 12 07:44:16 2008 -0500
+++ b/includes/clientside/static/editor.js	Tue Feb 12 22:17:58 2008 -0500
@@ -143,10 +143,6 @@
       // Current selection is TinyMCE - make span_wiki have the link and span_mce be plaintext
       var a = document.createElement('a');
       a.href = '#';
-      a.onclick = function() {
-        ajaxSetEditorPlain();
-        return false;
-      };
       a.appendChild(document.createTextNode($lang.get('editor_btn_wikitext')));
       span_wiki.appendChild(a);
       toggler.appendChild(span_wiki);
@@ -162,10 +158,6 @@
       toggler.appendChild(document.createTextNode(' | '));
       var a = document.createElement('a');
       a.href = '#';
-      a.onclick = function() {
-        ajaxSetEditorMCE();
-        return false;
-      };
       a.appendChild(document.createTextNode($lang.get('editor_btn_graphical')));
       span_mce.appendChild(a);
       toggler.appendChild(span_mce);
@@ -490,6 +482,26 @@
   $dynano('ajaxEditArea').object._edTimestamp = timestamp;
   $dynano('ajaxEditArea').setContent(content);
   
+  if ( allow_wysiwyg )
+  {
+    if ( readCookie('enano_editor_mode') == 'tinymce' )
+    {
+      var a = document.getElementById('enano_edit_btn_pt').getElementsByTagName('a')[0];
+      a.onclick = function() {
+        ajaxSetEditorPlain();
+        return false;
+      };
+    }
+    else
+    {
+      var a = document.getElementById('enano_edit_btn_mce').getElementsByTagName('a')[0];
+      a.onclick = function() {
+        ajaxSetEditorMCE();
+        return false;
+      };
+    }
+  }
+  
   // Autosave every 5 minutes           (m  *  s  *  ms)
   setInterval('ajaxPerformAutosave();', ( 5 * 60 * 1000 ));
 }