includes/clientside/static/editor.js
changeset 701 dd80cde96a6c
parent 693 f21aa64d050a
child 705 85943d71c214
equal deleted inserted replaced
700:491314c44d23 701:dd80cde96a6c
     2 
     2 
     3 // Idle time required for autosave, in seconds
     3 // Idle time required for autosave, in seconds
     4 var AUTOSAVE_TIMEOUT = 15;
     4 var AUTOSAVE_TIMEOUT = 15;
     5 var AutosaveTimeoutObj = null;
     5 var AutosaveTimeoutObj = null;
     6 var editor_img_path = cdnPath + '/images/editor';
     6 var editor_img_path = cdnPath + '/images/editor';
       
     7 var editor_save_lock = false;
     7 
     8 
     8 window.ajaxEditor = function(revid)
     9 window.ajaxEditor = function(revid)
     9 {
    10 {
    10   if ( KILL_SWITCH )
    11   if ( KILL_SWITCH )
    11     return true;
    12     return true;
   519 
   520 
   520 window.ajaxEditorSave = function(is_draft, text_override)
   521 window.ajaxEditorSave = function(is_draft, text_override)
   521 {
   522 {
   522   if ( !is_draft )
   523   if ( !is_draft )
   523     ajaxSetEditorLoading();
   524     ajaxSetEditorLoading();
       
   525   if ( is_draft && editor_save_lock )
       
   526     return false;
       
   527   else
       
   528     editor_save_lock = true;
       
   529   
   524   var ta_content = ( text_override ) ? text_override : $dynano('ajaxEditArea').getContent();
   530   var ta_content = ( text_override ) ? text_override : $dynano('ajaxEditArea').getContent();
   525   
   531   
   526   if ( !is_draft && ( ta_content == '' || ta_content == '<p></p>' || ta_content == '<p>&nbsp;</p>' ) )
   532   if ( !is_draft && ( ta_content == '' || ta_content == '<p></p>' || ta_content == '<p>&nbsp;</p>' ) )
   527   {
   533   {
   528     new MessageBox(MB_OK|MB_ICONSTOP, $lang.get('editor_err_no_text_title'), $lang.get('editor_err_no_text_body'));
   534     new MessageBox(MB_OK|MB_ICONSTOP, $lang.get('editor_err_no_text_title'), $lang.get('editor_err_no_text_body'));
   657           else
   663           else
   658           {
   664           {
   659             // The save was successful; reset flags and make another request for the new page content
   665             // The save was successful; reset flags and make another request for the new page content
   660             setAjaxLoading();
   666             setAjaxLoading();
   661             editor_open = false;
   667             editor_open = false;
       
   668             editor_save_lock = false;
   662             enableUnload();
   669             enableUnload();
   663             changeOpac(0, 'ajaxEditContainer');
   670             changeOpac(0, 'ajaxEditContainer');
   664             ajaxGet(stdAjaxPrefix + '&_mode=getpage&noheaders', function()
   671             ajaxGet(stdAjaxPrefix + '&_mode=getpage&noheaders', function()
   665               {
   672               {
   666                 if ( ajax.readyState == 4 && ajax.status == 200 )
   673                 if ( ajax.readyState == 4 && ajax.status == 200 )