diff --git a/sites/all/modules/autosave/autosave.js b/sites/all/modules/autosave/autosave.js index 06abaf0..dcd93cd 100644 --- a/sites/all/modules/autosave/autosave.js +++ b/sites/all/modules/autosave/autosave.js @@ -9,7 +9,7 @@ Drupal.attachAutosave = function() { } Drupal.saveForm = function() { - if (typeof tinyMCE == 'object') { + if (typeof tinyMCE == 'object' && tinyMCE.selectedInstance) { editorBookmark = tinyMCE.selectedInstance.selection.getBookmark(); editorIsDirty=true; tinyMCE.triggerSave(); @@ -34,7 +34,7 @@ Drupal.saveForm = function() { } }); //} - if (typeof tinyMCE == 'object') { + if (typeof tinyMCE == 'object' && tinyMCE.selectedInstance) { tinyMCE.selectedInstance.selection.moveToBookmark(editorBookmark); } setTimeout('Drupal.saveForm()', Drupal.settings['period'] * 1000); @@ -138,7 +138,7 @@ if (Drupal.jsEnabled) { else if ($(this).html() == 'Reset') { form = document.getElementById(autosaved_form_id); form.reset(); - if (typeof tinyMCE == 'object') $('#' + autosaved_form_id).formHash($('#' + autosaved_form_id).formHash()); + if (typeof tinyMCE == 'object' && tinyMCE.selectedInstance) $('#' + autosaved_form_id).formHash($('#' + autosaved_form_id).formHash()); //$('#autosave-status #keep a').html(''); $('#autosave-status #keep').css('display', 'none').css('visibility', 'hidden'); $(this).html('View');