includes/clientside/static/editor.js
changeset 474 3d751a6f2b05
parent 473 518bc2b214f1
child 476 f26a69c40431
equal deleted inserted replaced
473:518bc2b214f1 474:3d751a6f2b05
    14 var editor_img_path = scriptPath + '/images/editor';
    14 var editor_img_path = scriptPath + '/images/editor';
    15 
    15 
    16 // Idle time required for autosave, in seconds
    16 // Idle time required for autosave, in seconds
    17 var AUTOSAVE_TIMEOUT = 15;
    17 var AUTOSAVE_TIMEOUT = 15;
    18 var AutosaveTimeoutObj = null;
    18 var AutosaveTimeoutObj = null;
       
    19 var tinymce_initted = false;
    19 
    20 
    20 var enano_tinymce_options = {
    21 var enano_tinymce_options = {
    21   mode : "none",
    22   mode : "none",
    22   plugins : 'table,save,safari,pagebreak,style,layer,advhr,insertdatetime,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras' + do_popups,
    23   plugins : 'table,save,safari,pagebreak,style,layer,advhr,insertdatetime,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras' + do_popups,
    23   theme : 'advanced',
    24   theme : 'advanced',
    33   noneditable_noneditable_class : 'mce_readonly',
    34   noneditable_noneditable_class : 'mce_readonly',
    34   content_css : css_url
    35   content_css : css_url
    35 };
    36 };
    36 
    37 
    37 // Check tinyMCE to make sure its init is finished
    38 // Check tinyMCE to make sure its init is finished
    38 function tinymce_init_check()
    39 function tinymce_preinit_check()
    39 {
    40 {
    40   if ( typeof(tinyMCE.init) != 'function' )
    41   if ( typeof(tinyMCE.init) != 'function' )
    41     return false;
    42     return false;
    42   if ( typeof(tinymce.DOM) != 'object' )
    43   if ( typeof(tinymce.DOM) != 'object' )
    43     return false;
    44     return false;
    50 {
    51 {
    51   if ( typeof(tinyMCE) == 'object' )
    52   if ( typeof(tinyMCE) == 'object' )
    52   {
    53   {
    53     if ( !KILL_SWITCH && !DISABLE_MCE )
    54     if ( !KILL_SWITCH && !DISABLE_MCE )
    54     {
    55     {
    55       if ( !tinymce_init_check() )
    56       if ( !tinymce_preinit_check() && !force )
    56       {
    57       {
    57         setTimeout('initTinyMCE();', 200);
    58         setTimeout('initTinyMCE(false);', 200);
    58         return false;
    59         return false;
    59       }
    60       }
    60       tinyMCE.init(enano_tinymce_options);
    61       tinyMCE.init(enano_tinymce_options);
    61     }
    62       tinymce_initted = true;
    62   }
    63     }
    63 }
    64   }
    64 addOnloadHook(initTinyMCE);
    65 }
       
    66 // addOnloadHook(initTinyMCE);
    65 
    67 
    66 var editor_open = false;
    68 var editor_open = false;
    67 
    69 
    68 function ajaxEditor(revid)
    70 function ajaxEditor(revid)
    69 {
    71 {
   513   {
   515   {
   514     textarea.className = 'mce_readonly';
   516     textarea.className = 'mce_readonly';
   515     textarea.setAttribute('readonly', 'readonly');
   517     textarea.setAttribute('readonly', 'readonly');
   516   }
   518   }
   517   
   519   
   518   // If the editor preference is tinymce, switch the editor to TinyMCE now
       
   519   if ( readCookie('enano_editor_mode') == 'tinymce' && allow_wysiwyg )
       
   520   {
       
   521     $dynano('ajaxEditArea').switchToMCE();
       
   522   }
       
   523   $dynano('ajaxEditArea').object.focus();
   520   $dynano('ajaxEditArea').object.focus();
   524   $dynano('ajaxEditArea').object._edTimestamp = timestamp;
   521   $dynano('ajaxEditArea').object._edTimestamp = timestamp;
   525   $dynano('ajaxEditArea').setContent(content);
   522   $dynano('ajaxEditArea').setContent(content);
       
   523   
       
   524   // If the editor preference is tinymce, switch the editor to TinyMCE now
       
   525   if ( readCookie('enano_editor_mode') == 'tinymce' && allow_wysiwyg )
       
   526   {
       
   527     $dynano('ajaxEditArea').switchToMCE();
       
   528   }
   526   
   529   
   527   if ( allow_wysiwyg )
   530   if ( allow_wysiwyg )
   528   {
   531   {
   529     if ( readCookie('enano_editor_mode') == 'tinymce' )
   532     if ( readCookie('enano_editor_mode') == 'tinymce' )
   530     {
   533     {